In this problem we need to just find a equation,
a equation called conic frustrum volume:
V = (pi*h /3) *(R*R + R*r + r*r)
code(c++):
/*
Author : Mohammad Morsalin Hossain
Dept of ICE,NSTU
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ms(x) memset(x,0,sizeof(x))
#define ins insert
#define pi acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int main()
{
IOS
int test,to=0;
cin>>test;
while(test--)
{
int r1,r2,h,p;
cin>>r1>>r2>>h>>p;
double pr= r2 +(r1-r2)*((double)p/h);
double v;
v = (pi*p)*(((double)pr*(double)pr)+((double)pr*(double)r2)+((double)r2*(double)r2))/3.0;
printf("Case %d: %lf\n",++to,v);
}
return 0;
}
This site solely purposed on personal improvement. Consists my concepts and idea of several problem from well known online judges like LightOj, Leetcode, Codeforces, UVA, SPOJ etc.
Tuesday, 16 April 2019
Subscribe to:
Post Comments (Atom)
Monkey Banana Problem lightoj 1004
In this problem we will check which adjacent cell will benefits the monkey best. For this, we will check all possible solution of this pro...
-
Problem link In this problem you will be given two integer number a and b. You need to make a and b equal in exactly k operation(s). In one...
-
In this problem we will check which adjacent cell will benefits the monkey best. For this, we will check all possible solution of this pro...
No comments:
Post a Comment
If you have any doubts, let me know through comments