Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define nl "\n"
- #define PI 3.141592653
- using namespace std;
- main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int test;
- cin>>test;
- for(int i=1; i<=test; i++)
- {
- int r2, r1, h, p;
- double v, r;
- cin>>r2>>r1>>h>>p;
- r=r2+(r1-r2)*(double(p)/h);
- v=1/3.0*PI*p*(r*r+r2*r2+r*r2);
- printf("Case %d: %lf", i, v);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment