热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

【SDUT2416】FruitNinjaII——积分

FruitNinjaII题目描述Haveyoueverplayedapopulargamenamed“FruitNinja”?FruitNinja(knownasFruitNi

Fruit Ninja II

题目描述

这里写图片描述

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

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

第一次组队赛中,将高数的东西几乎快忘完了,没有求出公式,比赛完看高数书才大悟

#include
#include
#include using namespace std;const double Pi = acos(-1.0);int T;int main()
{scanf("%d",&T);double a,b,m;int z &#61; 1;while(T--){scanf("%lf %lf %lf",&a,&b,&m);if(m<0){m &#61; -m;}if(m>b){m &#61; b;}printf("Case %d: %.3f\n",z&#43;&#43;,Pi*a*b*(m&#43;b-(m*m*m&#43;b*b*b)*1.0/(3*b*b)));}return 0;
}


推荐阅读
  • 1.webkit内核中的一些私有的meta标签,这些meta标签在开发webapp时起到非常重要的作用(1) ... [详细]
  • Unity3D引擎的体系结构和功能详解
    本文详细介绍了Unity3D引擎的体系结构和功能。Unity3D是一个屡获殊荣的工具,用于创建交互式3D应用程序。它由游戏引擎和编辑器组成,支持C#、Boo和JavaScript脚本编程。该引擎涵盖了声音、图形、物理和网络功能等主题。Unity编辑器具有多语言脚本编辑器和预制装配系统等特点。本文还介绍了Unity的许可证情况。Unity基本功能有限的免费,适用于PC、MAC和Web开发。其他平台或完整的功能集需要购买许可证。 ... [详细]
  • Xcode离线安装帮助文档1.在线查看帮助文件:Xcode下查看帮助文件,菜单Help-DeveloperDocumentation在右上角搜索框中即可检索,但速度很慢 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 使用圣杯布局模式实现网站首页的内容布局
    本文介绍了使用圣杯布局模式实现网站首页的内容布局的方法,包括HTML部分代码和实例。同时还提供了公司新闻、最新产品、关于我们、联系我们等页面的布局示例。商品展示区包括了车里子和农家生态土鸡蛋等产品的价格信息。 ... [详细]
  • 本文介绍了iOS开发中检测和解决内存泄漏的方法,包括静态分析、使用instruments检查内存泄漏以及代码测试等。同时还介绍了最能挣钱的行业,包括互联网行业、娱乐行业、教育行业、智能行业和老年服务行业,并提供了选行业的技巧。 ... [详细]
  • 概述H.323是由ITU制定的通信控制协议,用于在分组交换网中提供多媒体业务。呼叫控制是其中的重要组成部分,它可用来建立点到点的媒体会话和多点间媒体会议 ... [详细]
  • 1、DashAPI文档Dash是一个API文档浏览器,使用户可以使用离线功能即时搜索无数API。程序员使用Dash可访问iOS,MacOS, ... [详细]
  • 与.Net大师Jeffrey Richter面对面交流——TUP对话大师系列活动回顾(多图配详细文字)...
    与.Net大师JeffreyRichter面对面交流——TUP对话大师系列活动回顾(多图配文字)上周末很有幸参加了CSDN举行的TUP活动, ... [详细]
  • Myappcrashedandthecodeisthefollowing:我的应用程序崩溃,代码如下:elseif(){CGDetailVie ... [详细]
author-avatar
mobiledu2502857017
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有