https://www.acmicpc.net/problem/2439
2439번: 별 찍기 - 2
첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제 하지만, 오른쪽을 기준으로 정렬한 별(예제 참고)을 출력하시오.
www.acmicpc.net
My Solution
using System;
using System.Text;
namespace taesooya
{
class test
{
static void Main(string[] args)
{
int T = int.Parse(Console.ReadLine());
for (int i = 1; i <= T; i++)
{
string s = new string('*', i);
//문자열 반복
Console.WriteLine(s);
}
}
}
}
using System;
using System.Text;
namespace taesooya
{
class test
{
static void Main(string[] args)
{
int T = int.Parse(Console.ReadLine());
for (int i = 1; i <= T; i++)
{
string s = new string('*', i).PadLeft(T,' ');
Console.WriteLine(s);
}
}
}
}
'👩💻Programming > Coding Test' 카테고리의 다른 글
[C#] [BOJ#2741] String Builder - N 찍기, 기찍 N (0) | 2022.07.30 |
---|---|
[C#] [BOJ#1110] 더하기 사이클 (0) | 2022.07.30 |
[C#] [BOJ#10951] A+B - 4 (0) | 2022.07.30 |
[C#] [BOJ#10952] A+B - 5 (0) | 2022.07.29 |
[C#] [BOJ#15552] String Builder - 빠른 A+B (0) | 2022.07.29 |
댓글