반응형
#include <iostream>
using namespace std;
int main() {
int num;
cin >> num;
if (num == 1)
cout << '*';
for (int i = 1; i < num; i++)
{
for (int t = 1; t <= num - i; t++)
{
cout << " ";
}
for (int j = 1; j <= i * 2 - 1; j++)
{
if (j == 1 || j == i * 2 - 1)
{
cout << "*";
continue;
}
else
{
cout << " ";
continue;
}
}
cout << '\n';
if (i + 1 == num)
{
for (int i = 1; i <= num * 2 -1; i++)
{
cout << "*";
}
}
}
}
'Algorithm' 카테고리의 다른 글
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 10950번:A+B-3 답 (0) | 2016.10.05 |
---|---|
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2558번:A+B-2 답 (0) | 2016.10.05 |
백준(baekjoon)(BaekJoon)코딩 10991번:별찍기-16 답 (0) | 2016.09.26 |
(C++) - 백준(BOJ) 2556번 : 별찍기-14 답 (2) | 2016.09.26 |
백준(baekjoon)(BaekJoon)코딩 2523번:별찍기-13 답 (0) | 2016.09.26 |