1. #include <bits/stdc++.h>
2.
3. using namespace std;
4.
5. int main()
6. {
7. ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );
8.
9. map<int,vector<int>> polygon;
10.
11. for( int ang = 1; ang < 180; ang++ )
12. {
13. int n, a = 180, b = 180 - ang, g = __gcd(a,b);
14.
15. if ( ( a /= g, b /= g ) == 1 )
16. n = 2 * a;
17. else
18. n = a;
19.
20. polygon[n].push_back(ang);
21. }
22.
23. cout << "% " << polygon.size() << " polygons." << endl,
24. cout << "% polygon(N,InscribedAngles)." << endl << endl;
25.
26. for(auto p: polygon)
27. {
28. auto q = p.second;
29.
30. cout << "polygon(" << p.first << ",[" << q.front();
31.
32. for(int i = 1, r = q.size(); i < r; i++)
33. cout << ',' << q[i];
34.
35. cout << "])." << endl;
36. }
37. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
% 22 polygons.
% polygon(N,InscribedAngles).

polygon(3,[60]).
polygon(4,[45,90]).
polygon(5,[36,72,108]).
polygon(6,[30,120]).
polygon(8,[135]).
polygon(9,[20,40,80,100,140]).
polygon(10,[18,54,126,144]).
polygon(12,[15,75,105,150]).
polygon(15,[12,24,48,84,96,132,156]).
polygon(18,[10,50,70,110,130,160]).
polygon(20,[9,27,63,81,99,117,153,162]).
polygon(24,[165]).
polygon(30,[6,42,66,78,102,114,138,168]).
polygon(36,[5,25,35,55,65,85,95,115,125,145,155,170]).
polygon(40,[171]).
polygon(45,[4,8,16,28,32,44,52,56,64,68,76,88,92,104,112,116,124,128,136,148,152,164,172]).
polygon(60,[3,21,33,39,51,57,69,87,93,111,123,129,141,147,159,174]).
polygon(72,[175]).
polygon(90,[2,14,22,26,34,38,46,58,62,74,82,86,94,98,106,118,122,134,142,146,154,158,166,176]).
polygon(120,[177]).
polygon(180,[1,7,11,13,17,19,23,29,31,37,41,43,47,49,53,59,61,67,71,73,77,79,83,89,91,97,101,103,107,109,113,119,121,127,131,133,137,139,143,149,151,157,161,163,167,169,173,178]).
polygon(360,[179]).