Banner Home Page DIY Contests Problems Ranklist Status Statistics
pdf版的题目下载:初赛goo.gl/rfbDY,决赛goo.gl/fNcyY。K题请使用GUN C++提交,用VC/VC++提交会返回RE。

Learn Calculus

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 34   Accepted Submission(s) : 16

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

  JYC is a fool guy. He is going to give a lesson to the ACM team members.
  This lesson is about calculus. He gives a classics example of calculus to the ACMers.
  The problem is to calculate the volume of the intersected part of the three same cylinders which are vertical to each other. But as a fool guy, he always forgets something, thus when he wants to show his skills of calculus, he forgets how to figure out the problem. Fortunately, Arios is good at maths, so he tells the fool guy "let me show you what is calculus!". Quickly, Arios finishes.
  
  Everyone in this contest must have learned calculus. Can you solve it by using calculus or other mathematic knowledge?

Input

  There are multiple test cases. The first line contains an integer T (T<=100), indicates the test cases.
  Next T line follow. There will be 2 floating numbers r and h (0<2r<=h<=10000) per line. r indicates the the radius of a cylinder, and h indicates the height. Remember that three cylinders are totally same.

Output

  For each test case, output "Case #D: " first, D is the test case number. Then following a floating number (round to 0.001) which is the volume of the intersected part of the three cylinders.

Sample Input

2
5.00 20.00
30.00 110.00

Sample Output

Case #1: 585.786
Case #2: 126529.871

Source

华南师范大学·2012年ACM程序设计竞赛·决赛

Statistic | Submit | Back