Last active
March 22, 2017 19:49
-
-
Save fa7ad/d18fd1138e89b2b4c91c6b73ea1d21c5 to your computer and use it in GitHub Desktop.
N-gon checker from codemarshal
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 <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
long long polygons; | |
cin >> polygons; | |
ostringstream outputText; | |
for (long long c = 0; c < polygons; c++) | |
{ | |
long long anglesum; | |
cin >> anglesum; | |
outputText << "Case " << c+1 << ": "; | |
if (anglesum % 180 == 0 && anglesum >= 180) { | |
long long sides = (anglesum / 180) + 2; | |
long double angle = (long double)anglesum / sides; | |
outputText << sides << " " << setprecision(10) << round(angle); | |
} else { | |
outputText << "Impossible"; | |
} | |
outputText << endl; | |
} | |
cout << outputText.str(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment