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;int 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;if(n>=110)return 0;
  14. for(int i=0;i<n;i++){
  15. for(int j=i+1;j<n;j++){
  16. for(int k=j+1;k<n;k++){
  17. Point p1=Point{SIN(360.0l*i/n),COS(360.0l*i/n)};
  18. Point p2=Point{SIN(360.0l*j/n),COS(360.0l*j/n)};
  19. Point p3=Point{SIN(360.0l*k/n),COS(360.0l*k/n)};
  20. long double d1=dst(p1,p2);
  21. long double d2=dst(p1,p3);
  22. long double d3=dst(p2,p3);
  23. long double d4=(d1+d2+d3)/2.0l;
  24. long double d5=sqrtl(d4*(d4-d1)*(d4-d2)*(d4-d3));
  25. vec.push_back(d5);
  26. }
  27. }
  28. }
  29. sort(vec.begin(),vec.end());
  30. printf("%.15Lf\n",vec[k-1]);
  31. return 0;
  32. }
Success #stdin #stdout 0s 3468KB
stdin
12 220
stdout
1.299038105676658