Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- typedef long long ll;
- typedef long double ld;
- ld pi = 3.14159265358979323846264 ;
- ld len(double a , double n , double r){
- return (a * sin(pi * r / n)) / sin(pi / n);
- }
- struct r {
- int i;
- int j;
- int k;
- };
- map < ld , r > store;
- ld ang(ld a , ld b , ld c){
- return (180.0 / pi) * acos( (pow(a , 2) + pow(b , 2) - pow(c , 2)) / (2 * a * b) );
- }
- ld x = 1.2345;
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- ll n;
- ld a;
- cin >> n >> a;
- int num = 3;
- if (n % 2 == 0){
- int th = 2;
- int se = 1;
- for(int i = 0 ; i < n / 2 - 1 ; i++){
- ld fir = x;
- ld sec = len(x , n , se);
- ld thi = len(x , n , th);
- if(store.find(abs(ang(fir , sec , thi) - a)) == store.end())
- store[abs(ang(fir , sec , thi) - a)] = {1 , 2 , num};
- if(store.find(abs(ang(sec , fir , thi) - a)) == store.end())
- store[abs(ang(sec , fir , thi) - a)] = {2 , 1 , num};
- if(store.find(abs(ang(sec , thi , fir) - a)) == store.end())
- store[abs(ang(sec , thi , fir) - a)] = {2 , num , 1};
- se++;
- th++;
- num++;
- }
- }
- else{
- int th = 2;
- int se = 1;
- for(int i = 0 ; i < n / 2 ; i++){
- ld fir = x;
- ld sec = len(x , n , se);
- ld thi = len(x , n , th);
- if(store.find(abs(ang(fir , sec , thi) - a)) == store.end())
- store[abs(ang(fir , sec , thi) - a)] = {1 , 2 , num};
- if(store.find(abs(ang(sec , fir , thi) - a)) == store.end())
- store[abs(ang(sec , fir , thi) - a)] = {2 , 1 , num};
- if(store.find(abs(ang(sec , thi , fir) - a)) == store.end())
- store[abs(ang(sec , thi , fir) - a)] = {2 , num , 1};
- se++;
- th++;
- num++;
- }
- }
- auto j = (*store.begin()).second;
- cout << j.i << " " << j.j << " " << j.k << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment