SDUT 2416:Fruit Ninja II

网友投稿 677 2022-08-26

SDUT 2416:Fruit Ninja II

SDUT 2416:Fruit Ninja II

Fruit Ninja II

Time Limit: 5000MS Memory limit: 65536K

题目描述

Have you ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for Nvidia Tegra 2 based Android devices) is a video game developed by Halfbrick. It was released April 21, 2010 for iPod Touch and iPhone devices, July 12, 2010 for the iPad, September 17, 2010 for Android OS devices. Fruit Ninja was well received by critics and consumers. The iOS version sold over 200,000 copies in its first month. By March 2011 total downloads across all platforms exceeded 20 million. It was also named one of Time magazine's 50 Best iPhone Apps of 2011.

"Swipe your finger across the screen to deliciously slash and splatter fruit like a true ninja warrior. Be careful of bombs - they are explosive to touch and will put a swift end to your juicy adventure!" - As it described on in Fruit Ninja the player slices fruit with a blade controlled via a touch pad. As the fruit is thrown onto the screen, the player swipes their finger across the screen to create a slicing motion, attempting to slice the fruit in parts. Extra points are awarded for slicing multiple fruits with one swipe, and players can use additional fingers to make multiple slices simultaneously. Players must slice all fruit; if three pieces of fruit are missed the game ends. Bombs are occasionally thrown onto the screen, and will also end the game should the player slice them. Maybe you are an excellent player of Fruit Ninja, but in this problem we focus on something more mathematically. Consider a certain slicing trace you create on the touch pad, you slice a fruit (an apple or a banana or something else) into two parts at once. Can you figure out the volume of each part?

Impossible task? Let us do some simplification by define our own Fruit Ninja game. In our new Fruit Ninja game, only one kind of fruit will be thrown into the air - watermelon. What's more, the shape of every watermelon is a special Ellipsoid (details reachable at that it's polar radius OC is always equals to it's equatorial radius OB. Formally, we can get this kind of solid by revolving a certain ellipse on the x-axis. And the slicing trace the player created (represented as MN in Illustration III) is a line parallel to the x-axis. The slicing motion slice the watermelon into two parts, and the section (shown as the dark part in Illustration III) is parallel to plane x-O-y. Given the length of OA, OB, OM (OM is the distance between the section and plane x-O-y), your task is to figure out the volume of the bigger part.

输入

There are multiple test cases. First line is an integer T (T ≈ 100), indicating the number of test cases. For each test case, there are three integers: a, b, H, corresponding the length of OA, OB, OM. You may suppose that 0 < b <= a <= 100 and 0 <= H <= 100.

输出

Output case number "Case %d: " followed by a floating point number (round to 3) for each test case.

示例输入

4

2 2 0

2 2 1

2 2 2

2 2 3

示例输出

Case 1: 16.755

Case 2: 28.274

Case 3: 33.510

Case 4: 33.510

提示

​​H=fabs(b);

#include #include #include #include #define PI acos(-1) using namespace std; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) { double a,b,h; cin>>a>>b>>h; h=fabs(h); if(h>fabs(b))h=fabs(b); double s=0; s=PI*a*b*h-PI*a*h*h*h/3.0/b; s+=4*PI*b*b*a/6.0; printf("Case %d: %.3lf\n",i,s); } return 0; }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:HDU 5688:2016
下一篇:如何在Android Studio项目中导入开源库(如何在ANDROID手机的运动健康添加音乐)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~