VioletaBabel

2445번: 별찍기 - 8 본문

백준/백준-C++
2445번: 별찍기 - 8
Beabletoet 2018. 2. 5. 12:00
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
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < i+1++j)
            cout << "*";
        for (int j = (n-i) * 2; j > 2--j)
            cout << " ";
        for(int j = 0; j < i+1++j)
            cout << "*";
        cout << endl;
    }
    for (int i = n - 1; i > 0--i)
    {
        for (int j = 0; j < i; ++j)
            cout << "*";
        for (int j = (n - i) * 2; j > 0--j)
            cout << " ";
        for (int j = 0; j < i; ++j)
            cout << "*";
        cout << endl;
    }
    return 0;
}
cs


'백준 > 백준-C++' 카테고리의 다른 글

11659번: 구간 합 구하기  (0) 2018.02.05
2605번: 줄 세우기  (0) 2018.02.05
1920번: 수 찾기  (0) 2017.09.15
2443번: 별찍기 - 6  (0) 2017.09.15
2444번: 별찍기 - 7  (0) 2017.09.15
Comments