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 Halfbrick. It wasreleased April 21, 2010 for iPod Touch and iPhone devices, July 12, 2010 forthe iPad, September 17, 2010
for Android OS devices. Fruit Ninja was wellreceived by critics and consumers. The iOS version sold over 200,000 copies inits first month. By March 2011 total downloads across all platforms exceeded 20million. It was also named one of Time magazine‘s 50 Best
iPhone Apps of 2011.

"Swipeyour finger across the screen to deliciously slash and splatter fruit like atrue ninja warrior. Be careful of bombs - they are explosive to touch and willput a swift end to your juicy adventure!" - As it described
onhttp://www.fruitninja.com/, in Fruit Ninja the player slices fruit with a bladecontrolled via a touch pad. As the fruit is thrown onto the screen, the player swipestheir finger across the screen to create a slicing motion, attempting to slicethe fruit in
parts. Extra points are awarded for slicing multiple fruits withone swipe, and players can use additional fingers to make multiple slicessimultaneously. Players must slice all fruit; if three pieces of fruit aremissed the game ends. Bombs are occasionally
thrown onto the screen, and willalso end the game should the player slice them.

Maybe you are an excellent player of Fruit Ninja, but in this problem we focus onsomething more mathematically. Consider a certain slicing trace you create onthe touch pad, you slice a fruit (an apple or a banana or something else) intotwo parts at once. Can
you figure out the volume of each part?

Impossibletask? 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 polarradius OC is always equals
to it‘s equatorial radius OB. Formally, we can getthis kind of solid by revolving a certain ellipse on the x-axis. And theslicing trace the player created (represented as MN in Illustration III) is aline parallel to the x-axis. The slicing motion slice the
watermelon into twoparts, and the section (shown as the dark part in Illustration III) is parallelto plane x-O-y.

Given the length of OA, OB, OM (OM is thedistance between the section and plane x-O-y), your task is to figure out thevolume of the bigger part.

输入

Thereare multiple test cases. First line is an integer T (T ≈ 100), indicating thenumber of test cases.

For each test case, there are three integers: a, b, H, corresponding the lengthof OA, OB, OM. You may suppose that0 < b <= a <= 100 and 0 <= H <= 100.

输出

Outputcase number "Case %d: " followed by a floating point number (round to3) 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

时间紧急,图片处理的不是太好,大家将就看吧

/***********************

刚看这个题目确实被吓到了,细致看了以后你会发现这就是一个高数上的三重积分的问题。

求椭球缺的体积參考:http://zhidao.baidu.com/link?url=VGl0sArergv86msYl9wilJwfMk29d--x2frRo0pNEkRoY7-3K2r5sbL-aR15Vcd_VwKLU2xpmEMFUgGVq7SI1K

椭球长半轴 a ,短半轴 b ,高 h,(h 就是 题中 的 h)

则椭球缺体积能够这样求:(Word 里的数学符号不能显示,截个图片吧)

PI 为圆周率

然后用这个体积加上半球的体积就OK了。。

公式: V = 2/3*PI*a*b*b+PI *a*(b*h—h^3/(3*b))

Code:

#include <iostream>
#include<stdio.h>
using namespace std;
const double PI =  3.14159265358;  //PI  = 3.1415926535  时 WA,所以注意精度
int main()
{
    int t,count = 1;;
    double a,b,h,V;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf",&a,&b,&h);
        if(h>=b)
            h = b;
        V = 2.0/3.0*PI*a*b*b+PI*a*b*h-PI*a*h*h*h/(3.0*b);
        printf("Case %d: ",count++);
        printf("%.3lf\n",V);
    }
    return 0;
}

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

时间: 2024-10-12 09:52:53

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

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 de

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 2603 Rescue The Princess(算是解析几何吧)(山东省第四届ACM省赛A题)

题目地址:sdut 2603 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

sdut2408 pick apples (贪心+背包)山东省第三届ACM省赛

本文出自:http://blog.csdn.net/svitter/ 题意:三种苹果,每种都有对应的Size,Value,给你一个背包空间,求最大的价值. 本题目的关键就在于非常大的背包空间 依据indicates the size (1 <= S<= 100) 我们可以考虑在1000000(100^3)之外的空间放性价比最高的苹果.为什么时100^3? 要知道背包如果正好填满,而填满空间相应价值的苹果大于不填满的价值的苹果,那么就选择能填满空间而使价值最大的苹果,而非性价比最高的苹果--性价

青岛理工ACM交流赛 J题 数格子算面积

数格子算面积 Time Limit: 1000MS Memory limit: 262144K 题目描述 给你一个多边形(用’\’和’/’表示多边形的边),求多边形的面积. 输入 第一行两个正整数h 和 w (2 ≤ h, w ≤ 100),h是多边形所在平面的高,w是多边形所在平面的宽,接下来h行,每行w个字符,描述了整个平面的每个单元(每个单元是一个单位面积),字符只会是’\’,’/’和’.’其中之一,’\’,’/’表示多边形的边,’.’表示空白单元. 输出 输出一个数,输入代表的平面内多边

2018 FJUT ACM 校赛 j题 外传:魔王打工记(一)

外传:魔王打工记(一) TimeLimit:1000MS  MemoryLimit:128MB 64-bit integer IO format:%lld Problem Description 话说Home_W大魔王手下有四大天王: 首席战神--赛文斯,SoftWork首席科学家--布莱克,首席军师--金金金,首席狙击手--超无聊,首席苦力--小明. 然而,这些部下个个都是饭桶,把Home_W都快吃穷.虽然Home_W嘴上说:打工是不可能打工的,这辈子不可能打工的.烧杀抢又不会做,就只有当正义

[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大学生程序设计竞赛]——n a^o7 !

n a^o7 ! 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413 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 hap

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

Mine Number 题目:http://acm.sdut.edu.cn/sdutoj/problem.php? action=showproblem&problemid=2410 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描写叙述 Every one once played the game called Mine Sweeping, here I change the rule. You are given an n*m ma