Saturday 29 July 2017

Lightoj 1216 - Juice in the Glass

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define pi 3.1415926535897932
  4. int main(){
  5.     int ts;
  6.     scanf("%d"&ts);
  7.     for(int j = 1; j <= ts; j++){
  8.     int r1, r2, h, p;
  9.     scanf("%d%d%d%d"&r1, &r2, &h, &p);
  10.     double r = ((p*1.0 * (r1-r2)*1.0)/(h*1.00))*1.0 + r2*1.00;
  11.     double x = (r2*1.0*h)/((r1-r2)*1.00);
  12.     double ans = (pi*(r*r*1.00*(p+x)-r2*r2*1.0*x))/(3.000);
  13.     printf("Case %d: %0.10lf\n",j, ans);
  14.     }
  15.     return 0;
  16. }

No comments:

Post a Comment

Most Featured Post

Lightoj 1159 - Batman

http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...