BOJ : https://www.acmicpc.net/problem/10995

github : https://github.com/junho0956/Algorithm/blob/master/10995/10995/%EC%86%8C%EC%8A%A4.cpp

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;
 
int main() {
    int n; cin >> n;
    int t = 1;
    while (t<=n) {
        if (t % 2) {
            int cnt = n - 1;
            for (int i = 1; i <= n; i++) {
                cout << "*";
                if (cnt) cout << " ", cnt--;
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                cout << " *";
            }
        }
        t++;
        cout << "\n";
    }
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter

'algorithm > BOJ' 카테고리의 다른 글

BOJ 2294번 동전 2  (0) 2020.02.21
BOJ 10835번 카드게임  (0) 2020.02.21
BOJ 11654번 아스키 코드  (0) 2020.02.21
BOJ 1149번 RGB거리  (0) 2020.02.21
BOJ 2941번 크로아티아 알파벳  (0) 2020.02.21

+ Recent posts