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 http://www.fruitninja.com/, 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 http://en.wikipedia.org/wiki/Ellipsoid) 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.

示例输入

42 2 02 2 12 2 22 2 3

示例输出

Case 1: 16.755Case 2: 28.274Case 3: 33.510Case 4: 33.510

提示

In case 4, H is larger than b, which simply represent a miss.

http://www.fruitninja.com/
http://en.wikipedia.org/wiki/Fruit_Ninja
http://en.wikipedia.org/wiki/Ellipsoid

来源

2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛

解题思路:

高数上的三重积分。注意:PI的精度要大些,一开始用的3.1415926通不过,精度太小,后来百度3.1415926535898。还有浮点数的除法记得*1.0。

题目中的oc = ob这条信息特别关键。

代码:

#include <iostream>
#include <cmath>
#include <stdio.h>
#include <iomanip>
using namespace std;
#define pi 3.1415926535898
int main()
{
int t;cin>>t;int c=1;
int a,b,h;
while(t--)
{
cin>>a>>b>>h;
if(h>b)
{
h=b;
}
double n1=pi*a*b*(h-h*h*h/(3.0*b*b)+b-(b*b*b)/(3.0*b*b));
cout<<"Case "<<c++<<": "<<setiosflags(ios::fixed)<<setprecision(3)<<n1<<endl;
}
return 0;
}

[2012山东ACM省赛] Fruit Ninja II (三重积分,椭球体积)相关推荐

  1. [2012山东ACM省赛] The Best Seat in ACM Contest (模拟)

    The Best Seat in ACM Contest Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Cainiao is a ...

  2. Sdut 2416 Fruit Ninja II(山东省第三届ACM省赛 J 题)(解析几何)

    Time Limit: 5000MS Memory limit: 65536K 题目描写叙述 Haveyou ever played a popular game named "Fruit ...

  3. 山东ACM省赛酱油记

    ACM省赛酱油记 比赛结束许久了,但一直没能静下心写点感想.直到昨天,集训队的所有队员集聚一堂,包括已经考上研的集训队第一批学长学姐,一起谈了谈多年的ACM经历.感受与收获,感触良多,又在今天看到了学 ...

  4. [2010山东ACM省赛] Greatest Number(数的组合+二分搜索)

    Greatest Number Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Saya likes math, because ...

  5. [2011山东ACM省赛] Identifiers(模拟)

    Identifiers Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 Identifier is an important ...

  6. 山东省第三届ACM省赛

    ID Title Hint A Impasse (+)   B Chess   C An interesting game 最小费用最大流 D n a^o7 !   E Fruit Ninja I d ...

  7. 2018ACM上海大都会赛: A. Fruit Ninja(这绝对是道原题+随机)

    题目描述 Fruit Ninja is a juicy action game enjoyed by millions of players around the world, with squish ...

  8. ACM训练赛--递推专题

    1001: Buy the Ticket Problem Description The "Harry Potter and the Goblet of Fire" will be ...

  9. 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - F - A Mame】

    Home Problems Status Contest Register Login B题要套一个数论的模版,注意m=1!! C题可以二分匹配,把行列看作点; 不能开百度,开谷歌搜题解,再次强调!一 ...

最新文章

  1. 机器学习理论篇:机器学习的数学基础
  2. wien2k 2009 编译方法
  3. Spring 的循环依赖:真的必须非要三级缓存吗?
  4. BurpSuite使用——HTTP
  5. [Ubuntu] 查看内核和版本号
  6. hyperkube记录
  7. Vfloopy仿真虚拟软驱写软盘
  8. 企业邮箱管理员如何管理邮箱
  9. 用Python的statsmodels包做前向逐步回归
  10. Mac 配置 docker 基本操作
  11. 网页集成大华摄像头以及回放功能2019.11.14
  12. Java HashSet和Java HashMap
  13. 自定义微信小程序tabBar组件上边框的颜色
  14. Linux文件复制、移动、删除等操作命令
  15. 移动端图片剪裁工具cropperjs
  16. Lance老师UI系列教程第三课-QQ登录注册界面的实现(android-2012最新版)
  17. iperf安装与使用
  18. 程序人生:必须了解的程序员 8个职业发展方向
  19. 智能合约 web3.js ABI Address三者的关系
  20. 最新《老男孩JAVA架构师之路成长课程》

热门文章

  1. 英语计算机单词mp3,[听单词] 计算机专业英语词汇音频51,计算机英语单词MP3
  2. 7-1 计算π的值 (10分)_PTA_Java基础练习
  3. Mac系统打开命令行终端及查看操作系统版本号的方法
  4. 从代理设计模式到Spring AOP
  5. hdu4966 朱刘算法
  6. 低配版点燃我温暖你爱心代码
  7. 【配置】GitHub Pages使用阿里云域名
  8. 跟我学Android之十一 列表和适配器
  9. 吸附去除溶液重金属离子工艺原理
  10. 导出icloud照片到电脑_如何将Apple iCloud和iPhone联系人导出到Windows 10