Created
July 4, 2017 11:37
-
-
Save riemannulus/db5ce2d0eea00a94d2cab50bfeab9c6c to your computer and use it in GitHub Desktop.
Pointing a Star - 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/* | |
2442번 문제를 2번 반복하면 되는 문제이다 | |
수행시간은 O(n^2) | |
*/ | |
int main() | |
{ | |
int a, b = 0; | |
scanf("%d", &a); | |
while(a--) | |
{ | |
b++; | |
for (int i = 0; i < a; i++) printf(" "); | |
for (int i = 0; i < 2 * b - 1; i++) printf("*"); | |
printf("\n"); | |
} | |
a++; | |
while (b--) | |
{ | |
a++; | |
for (int i = 0; i < a; i++) printf(" "); | |
for (int i = 0; i < 2 * b - 1; i++) printf("*"); | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment