문제 : https://www.acmicpc.net/problem/2523
[알고리즘풀이]
위, 아래로 나눠서 따로 구현하면 된다.
#include<iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
for (int i = 1; i <= n; i++){
for (int j = 0; j < i; j++)
cout << '*';
cout << '\n';
}
for (int i = n - 1; i > 0; i--){
for (int j = 0; j < i; j++)
cout << '*';
cout << '\n';
}
}
'Problem Solving > BOJ' 카테고리의 다른 글
[BOJ] 2583 : 영역구하기 - travelbeeee (0) | 2019.10.28 |
---|---|
[BOJ] 2556 : '별 찍기 - 14' travelbeeee (0) | 2019.10.26 |
[BOJ] 2522 : '별 찍기-12' travelbeeee (0) | 2019.10.26 |
[BOJ] 2447 - '별 찍기 - 10' (0) | 2019.10.26 |
[BOJ] 2446 - '별 찍기 - 9' (0) | 2019.10.26 |