fork download
  1. #include <bits/stdc++.h>
  2.  
  3. #define pii pair <int,int>
  4. #define pll pair <long long,long long>
  5. #define sc scanf
  6. #define pf printf
  7. #define Pi 2*acos(0.0)
  8. #define ms(a,b) memset(a, b, sizeof(a))
  9. #define pb(a) push_back(a)
  10. #define MP make_pair
  11. #define db double
  12. #define ll long long
  13. #define EPS 10E-10
  14. #define ff first
  15. #define ss second
  16. #define sqr(x) (x)*(x)
  17. #define D(x) cout<<#x " = "<<(x)<<endl
  18. #define VI vector <int>
  19. #define DBG pf("Hi\n")
  20. #define MOD 1000000007
  21. #define CIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  22. #define SZ(a) (int)a.size()
  23. #define sf(a) scanf("%d",&a)
  24. #define sfl(a) scanf("%lld",&a)
  25. #define sff(a,b) scanf("%d %d",&a,&b)
  26. #define sffl(a,b) scanf("%lld %lld",&a,&b)
  27. #define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
  28. #define sfffl(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
  29. #define stlloop(v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
  30. #define loop(i,n) for(int i=0;i<n;i++)
  31. #define loop1(i,n) for(int i=1;i<=n;i++)
  32. #define REP(i,a,b) for(int i=a;i<b;i++)
  33. #define RREP(i,a,b) for(int i=a;i>=b;i--)
  34. #define TEST_CASE(t) for(int z=1;z<=t;z++)
  35. #define PRINT_CASE printf("Case %d: ",z)
  36. #define CASE_PRINT cout<<"Case "<<z<<": "
  37. #define all(a) a.begin(),a.end()
  38. #define intlim 2147483648
  39. #define infinity (1<<28)
  40. #define ull unsigned long long
  41. #define gcd(a, b) __gcd(a, b)
  42. #define lcm(a, b) ((a)*((b)/gcd(a,b)))
  43.  
  44. using namespace std;
  45.  
  46.  
  47. /*----------------------Graph Moves----------------*/
  48. //const int fx[]={+1,-1,+0,+0};
  49. //const int fy[]={+0,+0,+1,-1};
  50. //const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
  51. //const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
  52. //const int fx[]={-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
  53. //const int fy[]={-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
  54. /*------------------------------------------------*/
  55.  
  56. /*-----------------------Bitmask------------------*/
  57. //int Set(int N,int pos){return N=N | (1<<pos);}
  58. //int reset(int N,int pos){return N= N & ~(1<<pos);}
  59. //bool check(int N,int pos){return (bool)(N & (1<<pos));}
  60. /*------------------------------------------------*/
  61.  
  62.  
  63. int main()
  64. {
  65.  
  66. ///freopen("in.txt","r",stdin);
  67. ///freopen("out.txt","w",stdout);
  68.  
  69. int t;
  70. sf(t);
  71. TEST_CASE(t)
  72. {
  73. double l,n,c;
  74. sc("%lf %lf %lf",&l,&n,&c);
  75. double final_length=(1.0+n*c)*l;
  76.  
  77. double lo=0.0, hi=l;
  78.  
  79. for(int i=0;i<60;i++)
  80. {
  81. double mid=(lo+hi)/2.0;
  82. double radius=(mid/2.0)+(sqr(l)/(8.0*mid));
  83. double theta=2.0*asin((l/2.0)/radius);
  84. double temp_length=theta*radius;
  85. if(temp_length>=final_length)
  86. hi=mid;
  87. else
  88. lo=mid;
  89. }
  90.  
  91. PRINT_CASE;
  92. pf("%.10lf\n",lo);
  93.  
  94. }
  95.  
  96. return 0;
  97. }
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
Standard output is empty