반응형
깃 링크 : 바로가기
링크 : 바로가기
1차시도
using System.Text;
public class num_2439
{
public static void Main()
{
int max = Convert.ToInt32(Console.ReadLine());
StringBuilder result = new StringBuilder();
for (int i = 0; i < max; i++)
{
for (int x = 0; x < max - i - 1; x++)
{
result.Append(" ");
}
for (int x = 0; x < i + 1; x++)
{
result.Append("*");
}
result.Append("\n");
}
Console.WriteLine(result.ToString());
}
}
결과
- 최대 갯수에서 찍어야하는 "*"갯수 를 빼 빈공간으로 만들어주고 "*"찍어 출력
반응형
'기타 > 코딩테스트 공부' 카테고리의 다른 글
[백준] A+B(4) - 10951번 (0) | 2025.05.01 |
---|---|
[백준] A+B(5) - 10952번 (0) | 2025.05.01 |
[백준] 별 찍기 - 2438번 (0) | 2025.05.01 |
[백준] A+B-8 - 11022번 (0) | 2025.05.01 |
[백준] A+B-7 - 11021번 (0) | 2025.05.01 |