Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<stdio.h>
- #include<math.h>
- #include<cmath>
- #define pi 2*acos(0.0)
- using namespace std;
- int main()
- {
- freopen("input.txt","r",stdin);
- int t,i;
- cin>>t;
- for(i=1;i<=t;i++){
- double r1,r2,h,p,x,r,v;
- cin>>r1>>r2>>h>>p;
- x=(h*r2)/(r1-r2);
- r=(r2*(p+x))/x;
- v=(pi*((r*r*(h+x))-(r2*r2*x)))/3;
- printf("Case %d: %f\n",i,v);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement