NotAlpha102

Juice in the Glass

Mar 21st, 2020
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define nl "\n"
  3. #define PI 3.141592653
  4. using namespace std;
  5. main()
  6. {
  7.     ios_base::sync_with_stdio(false);
  8.     cin.tie(NULL);
  9.     int test;
  10.     cin>>test;
  11.     for(int i=1; i<=test; i++)
  12.     {
  13.         int r2, r1, h, p;
  14.         double v, r;
  15.         cin>>r2>>r1>>h>>p;
  16.         r=r2+(r1-r2)*(double(p)/h);
  17.         v=1/3.0*PI*p*(r*r+r2*r2+r*r2);
  18.         printf("Case %d: %lf", i, v);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment