首页 > 专题系列 > Java解POJ > POJ 3737 UmBasketella [解题报告] Java
2013
11-13

POJ 3737 UmBasketella [解题报告] Java

UmBasketella

问题描述 :

In recent days, people always design new things with multifunction. For instance, you can not only use cell phone to call your friends, but you can also use your cell phone take photographs or listen to MP3. Another example is the combination between watch and television. These kinds of multifunction items can always improve people’s daily life and are extremely favored by users.

The company Mr. Umbrella invented a new kind umbrella “UmBasketella” for people in Rainbow city recently and its idea also comes from such multifunction–the combination of umbrella and daily necessities. This kind of umbrella can be used as a basket and you can put something you want to carry in it. Since Rainbow city rains very often, such innovative usage is successful and “UmBasketella” sells very well. Unfortunately, the original “UmBasketella” do not have an automatic volume control technology so that it is easily damaged when users try to put too many things in it. To solve this problem, you are needed to design an “UmBasketella” with maximum volume. Suppose that “UmBasketella” is a cone-shape container and its surface area (include the bottom) is known, could you find the maximum value of the cone?

输入:

Input contains several test cases. Eash case contains only one real number S, representing the surface area of the cone. It is guaranteed that 1≤S≤10000.

输出:

For each test case, output should contain three lines.
The first line should have a real number representing the maximum volume of the cone.
Output the height of the cone on the second line and the radius of the bottom area of the cone on the third line.
All real numbers should rounded to 0.01.

样例输入:

30

样例输出:

10.93
4.37
1.55

解题代码:

//* @author: 
import java.util.*;
public class Main{
 static final double pi=Math.PI;
public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    double s;
    while (sc.hasNext()) {
      s=sc.nextDouble();
      double h=Math.sqrt(2*s/pi);
      double r=Math.sqrt(s*s/(pi*pi*h*h+2*pi*s));
      double v=(1.0/3.0)*(s*s)*h/(pi*h*h+2*s);
      System.out.printf("%.2f\n%.2f\n%.2f\n",v,h,r);
	}
  }
}

  1. 我还有个问题想请教一下,就是感觉对于新手来说,递归理解起来有些困难,不知有没有什么好的方法或者什么好的建议?

  2. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there's even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That's right AUTOMATICALLY, just watch this 4minute video for more information at.