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
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.

示例输入

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

提示

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大学生程序设计竞赛


  数学题

  运用高数中的三重积分演算出求椭圆台的体积公式。然后直接套公式过。

  模拟赛的时候是帅爷做出来的,唉,高数不好的孩子只能远远的看着啊!数学真的很重要,有时间一定要好好补补。

  注意OM>=OB的情况,不需要计算椭圆台的体积,直接输出整个椭圆球体的体积。

  代码:


 1 #include <iostream>
2 #include <stdio.h>
3 #include <cmath>
4 const double PI = acos(-1);
5 using namespace std;
6
7 int main()
8 {
9 int T;
10 cin>>T;
11 for(int i=1;i<=T;i++){
12 double a,b,m;
13 cin>>a>>b>>m;
14 double Vsum = 4*PI*a*b*b/3/2;
15 double Vsma = PI*a*b*(m-m*m*m/(3*b*b));
16 if(m>=b)
17 printf("Case %d: %.3lf\n",i,2*Vsum);
18 else
19 printf("Case %d: %.3lf\n",i,Vsum+Vsma);
20 }
21 return 0;
22 }
23
24
25 /**************************************
26 Problem id : SDUT OJ J
27 User name : Miracle
28 Result : Accepted
29 Take Memory : 540K
30 Take Time : 0MS
31 Submit Time : 2014-04-27 11:53:58
32 **************************************/

Freecode : www.cnblogs.com/yym2013

sdut 2416:Fruit Ninja II(第三届山东省省赛原题,数学题),码迷,mamicode.com

时间: 2024-08-04 02:42:36

sdut 2416:Fruit Ninja II(第三届山东省省赛原题,数学题)的相关文章

sdut 2411:Pixel density(第三届山东省省赛原题,字符串处理)

Pixel density Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Pixels per inch (PPI) or pixel density is a measurement of the resolution of devices in various contexts; typically computer displays, image scanners, and digital camera image s

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

Time Limit: 5000MS Memory limit: 65536K 题目描写叙述 Haveyou ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for NvidiaTegra 2 based Android devices) is a video game developed by Hal

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)

n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my inst

sdut 2610:Boring Counting(第四届山东省省赛原题,划分树 + 二分)

Boring Counting Time Limit: 3000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 In this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. Now you task is to answer a list of queries, for each quer

sdut 2603:Rescue The Princess(第四届山东省省赛原题,计算几何,向量旋转 + 向量交点)

Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia

[2012山东省第三届ACM大学生程序设计竞赛]——Fruit Ninja II

Fruit Ninja II 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2416 Time Limit: 5000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Have you ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja

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

大概去年夏天的时候,在<C和指针>里面一个练习题要求实现一个很简单的不包含打印浮点数功能的printf函数.但是很好奇,于是一直纠结下去,结果就是知道了printf的实现,自己也写了一个简单的.或许是夏天的原因吧,那时候暑假没回去,凌晨四点兴奋到不能睡觉.那时候刚开始写blog.没想整理一下,只是简单的把最重要的实现"工具"贴了一个blog在 http://blog.csdn.net/cinmyheart/article/details/9804189 那时候第一次看lin

Sdut2411 Pixel density 山东省第三届ACM省赛(输入输出字符串处理)

本文出处:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2411 题意:给你一个串,让你依据那个串来输出ppi.坑特别多.ppi的计算方法是dp / inches; dp = sqrt(wp*wp + hp * hp); 现在我来说说这个题目有多坑: 给你的串的格式是这样: name + inches+ "inches"

Sdut 2108 Alice and Bob(数学题)(山东省ACM第四届省赛D题)

题目地址:sdut 2608 Alice and Bob Alice and Bob Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*....