Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 너비우선탐색
- 철자검사
- horner
- BFS
- 백준
- 이분탐색
- 통계
- 선형대수학
- C++
- 파라메트릭 서치
- 9095 C++
- 문자열
- 백준 C#
- 백준 9465
- 확률
- 프로그래머스
- cpp
- C#
- 통계학
- 프로그래머스C#
- horner algorithm
- 알고리즘
- 프로그래머스 c#
- 입출력
- 스티커 C++
- 확률론
- dp
- 코딩테스트
- 수치해석
- C
Archives
- Today
- Total
HOIT_B
[백준]C# 2446 별찍기7 본문
728x90
[문제]
2446번: 별 찍기 - 9
첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다.
www.acmicpc.net
[ ]
공백 :0부터 1씩 N까지 커짐
별 : 윗부분 i번째 칸에 (2N-1)-2*i
[코드]
using System;
class star{
static void Main(){
int n = int.Parse(Console.ReadLine());
for(int i=0; i<n-1; i++){
for(int j=0; j<i; j++){
Console.Write(" ");
}
for(int k=0; k<2*(n-i)-1; k++){
Console.Write("*");
}
Console.WriteLine();
}
for(int i=n-1; i>=0; i--){
for(int j=0; j<i; j++){
Console.Write(" ");
}
for(int k=0; k<2*(n-i)-1; k++){
Console.Write("*");
}
Console.WriteLine();
}
}
}
728x90
'작고소중한 알고리즘 풀기' 카테고리의 다른 글
[백준]C#,C++ 11726번 2xn 타일링 (0) | 2021.01.27 |
---|---|
[백준]C# 1463번 1로 만들기 (0) | 2021.01.27 |
[백준] C# 2522 별찍기 12 (0) | 2021.01.24 |
[백준]C# 2445 별찍기8 (0) | 2021.01.24 |
[백준]C# 2442 별 찍기 5 (0) | 2021.01.23 |
Comments