Skip to content

Instantly share code, notes, and snippets.

@riemannulus
Created July 4, 2017 11:37
Show Gist options
  • Save riemannulus/db5ce2d0eea00a94d2cab50bfeab9c6c to your computer and use it in GitHub Desktop.
Save riemannulus/db5ce2d0eea00a94d2cab50bfeab9c6c to your computer and use it in GitHub Desktop.
Pointing a Star - 7
#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