Cuts the cake

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2202    Accepted Submission(s): 1354

Problem Description
Ice cream took a bronze medal in the Beijing match. Liu sir is very very happy. So he buys a cake for them. kiki is a child who likes eating, so the task of cuting cake was given to kiki. kiki is also a mischievous child. She wants to cut the cake in a different way. This is introduced in the figure below.

But there is a difficult problem.which is how to make each preson get equally many cake. kiki is not good at match, so she wants you help her solve this problem. 

 
Input
Input contains multiple test cases. Each line is a case. Each case contains only one integer R which is the radius. The input is terminated with a R of 0.

 
Output
For each test case, you should printf two numbers r2 and r1 in a line, accurate up to 3 decimal places, separate them by one space.

 
Sample Input
10
15
5
25
0
 
Sample Output
5.774 8.165
8.660 12.247
2.887 4.082
14.434 20.412
 
 
import java.util.Scanner;

public class Main{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
while(true){
int r=input.nextInt();
if(r==0)
break;
double sum=Math.PI*r*r;
double R=sum/3;
double r1=Math.sqrt(R/Math.PI);
double r2=Math.sqrt(2*R/Math.PI);
System.out.println(String.format("%.3f %.3f", r1,r2));
}
}
}

Cuts the cake_hdu_2134.java的更多相关文章

  1. Spark案例分析

    一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...

  2. Java性能提示(全)

    http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...

  3. [zz]Java中的instanceof关键字

    1.What is the 'instanceof' operator used for? stackoverflow的一个回答:http://stackoverflow.com/questions/ ...

  4. java jodd框架介绍及使用示例

    Jodd是一个普通开源Java包.你可以把Jodd想象成Java的"瑞士军刀",不仅小,锋利而且包含许多便利的功能.Jodd 提供的功能有:  提供操作Java bean,  可以 ...

  5. Java instanceof 关键字是如何实现的?

    作者:RednaxelaFX链接:https://www.zhihu.com/question/21574535/answer/18998914来源:知乎著作权归作者所有.商业转载请联系作者获得授权, ...

  6. 200个最常见的JAVA面试问题(附答案)

    本文内容: 20个最常见的JAVA面试问题(附答案) 13个单例模式JAVA面试问题(附答案) 说说JVM和垃圾收集是如何工作的(附答案) 说说如何避免JAVA线程死锁(附答案) Java中HashS ...

  7. android java epson串口打印机

    package com.common.util.portprinter; import java.io.IOException; import java.io.OutputStream; import ...

  8. Java for LeetCode 132 Palindrome Partitioning II

    Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...

  9. Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(十)之Inner Classes

    The inner class is a valuable feature because it allows you to group classes that logically belong t ...

随机推荐

  1. 自定义ImageView实现图片手势滑动,多点触摸放大缩小效果

    首先呢,还是一贯作风,我们先来看看众多应用中的示例:(这种效果是很常见的,可以说应用的必须品.)                搜狐客户端                               ...

  2. CH BR8(小学生放假了-clock()/CLOCKS_PER_SEC-斜率优化常错集锦)

    小学生放假了 总时限 26s 内存限制 256MB 出题人 zsyzzsoft 提交情况 16/150 初始分值 1500 锁定情况 背景 我们能见到的最可怕的事情,莫过于小学生放假了! 描述 小学生 ...

  3. Eclipse中如何安装和使用GrepCode插件

    GrepCode(GC)Eclipse插件允许Eclipse用户在Eclipse IDE中搜索由GrepCode提供的工厂类.本教程介绍如何安装和使用插件.使用Eclipse3.5(Galileo)的 ...

  4. ComboTree( 树型下拉框) 组件

    本节课重点了解EasyUI中Tree(树)组件的使用方法, 这个组件依赖于Combo(下拉框)和 Tree(树)组件.一. 加载方式//class 加载方式<select id="cc ...

  5. Entity Framework 4.1 绕过 EF 查询映射

    原文:http://blog.csdn.net/eqera/article/details/8411437 这是这了系列的最后一篇,我将讨论如何绕过 EF 的查询映射. 像所有优秀的框架一样,EF 知 ...

  6. css属性之vertical-align详解

    inline-block 该值会让元素生成一个内联级块容器(inline-level block container).一个inline-block的内部会被格式化成一个块盒,而该元素本身会被格式化成 ...

  7. git开源项目协作

    开源项目协作 fork开源项目,即打开开源项目的github,然后点击fork按钮 pull request

  8. 递归生成树对象,应用于Easyui,Tree控件

    1.生成树节点对象 /// <summary> /// 生成树的节点 /// </summary> public class TreeNode { public TreeNod ...

  9. SqlServer 数据库进行定时自动的执行脚本

    需求:数据库进行自动执行脚本操作,有些数据库操作就不需要写程序来定时执行,完全可以交给我们SqlServer客户端代理来做,下面的步骤,我是结合前一篇文章的SqlServer不同服务器数据库之间数据传 ...

  10. JS正则验证格式

    function test() { var temp = document.getElementById("text1"); //对电子邮件的验证 var myreg = /^([ ...