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
- 너비우선탐색
- C#
- 백준
- 통계
- 철자검사
- 파라메트릭 서치
- dp
- 프로그래머스
- 알고리즘
- 확률
- BFS
- 통계학
- C++
- C
- 스티커 C++
- cpp
- 프로그래머스C#
- 확률론
- 9095 C++
- 프로그래머스 c#
- 백준 C#
- 이분탐색
- 수치해석
- horner algorithm
- 문자열
- 코딩테스트
- 입출력
- 백준 9465
Archives
- Today
- Total
HOIT_B
[백준]C# 2445 별찍기8 본문
728x90
[문제]
2445번: 별 찍기 - 8
첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다.
www.acmicpc.net
[ ]
별과 별 사이에 공백이 N*2-2*i 이다.
문제의 예시를 보면
* -8-*
** -6- **
.
.
*****-0-*****
[코드]
using System;
class star{
static void Main(){
int n = int.Parse(Console.ReadLine());
for(int i=1; i<=n; i++){
for(int j=1; j<=i; j++){
Console.Write("*");
}
for(int k=1; k<=(2*n)-(2*i); k++){
Console.Write(" ");
}
for(int j=1; j<=i; j++){
Console.Write("*");
}
Console.WriteLine();
}
//아래
for(int i=1; i<n; i++){
for(int j=1; j<=n-i; j++){
Console.Write("*");
}
for(int k=1; k<=2*i; k++){
Console.Write(" ");
}
for(int j=1; j<=n-i; j++){
Console.Write("*");
}
Console.WriteLine();
}
}
}
728x90
'작고소중한 알고리즘 풀기' 카테고리의 다른 글
[백준]C# 2446 별찍기7 (0) | 2021.01.25 |
---|---|
[백준] C# 2522 별찍기 12 (0) | 2021.01.24 |
[백준]C# 2442 별 찍기 5 (0) | 2021.01.23 |
[백준] 1924 번 C# (0) | 2021.01.23 |
[백준] 11022번 C# (0) | 2021.01.23 |
Comments