fork(1) download
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<vector>
  4. #include<cmath>
  5. #include<cstdio>
  6. using namespace std;
  7. vector<long double>vec;long long n,k;
  8. struct Point{long double px,py;};
  9. long double SIN(long double r){return sin(3.14159265358979323846l/180.0l*r);}
  10. long double COS(long double r){return cos(3.14159265358979323846l/180.0l*r);}
  11. long double dst(Point a,Point b){return sqrtl((b.px-a.px)*(b.px-a.px)+(b.py-a.py)*(b.py-a.py));}
  12. int main(){
  13. cin>>n>>k;k*=6;
  14. for(int i=0;i<=0;i++){
  15. for(int j=1;j<n;j++){
  16. for(int k=1;k<n;k++){
  17. if(j==k)continue;
  18. Point p1=Point{SIN(360.0l*i/n),COS(360.0l*i/n)};
  19. Point p2=Point{SIN(360.0l*j/n),COS(360.0l*j/n)};
  20. Point p3=Point{SIN(360.0l*k/n),COS(360.0l*k/n)};
  21. long double d1=dst(p1,p2);
  22. long double d2=dst(p1,p3);
  23. long double d3=dst(p2,p3);
  24. long double d4=(d1+d2+d3)/2.0l;
  25. long double d5=sqrtl(d4*(d4-d1)*(d4-d2)*(d4-d3));
  26. vec.push_back(d5);
  27. }
  28. }
  29. }
  30. sort(vec.begin(),vec.end());
  31. printf("%.15Lf\n",vec[(k+n-1)/n-1]);
  32. return 0;
  33. }
Success #stdin #stdout 0s 3476KB
stdin
12 220
stdout
1.299038105676658