题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2416
Fruit Ninja II
题目大意:给你一个椭圆,切成两半,让你求出体积大的那个体积。(纯粹高数题)推导过程不难,给你一个别人已经推好了的过程,很简单的。。。
http://zuoye.baidu.com/question/34425a9ba53879ad3954c730fa5bd232.html
http://blog.csdn.net/zhengnanlee/article/details/8990969
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define pi acos(-1.0)
using namespace std;
int main()
{
int T,t=1;
scanf("%d",&T);
while(T--)
{
int a,b,h;
double v;
scanf("%d%d%d",&a,&b,&h);
if(h>=b)
{
printf("Case %d: %.3lf\n",t++,4.0/3*pi*a*b*b);
continue;
}
v=2.0/3*pi*a*b*b+pi*a*b*(h-h*h*h*1.0/(3*b*b));
printf("Case %d: %.3lf\n",t++,v);
}
return 0;
}