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. Android Fragment详解(二):Fragment创建及其生命周期

    Fragments的生命周期 每一个fragments 都有自己的一套生命周期回调方法和处理自己的用户输入事件. 对应生命周期可参考下图: 创建片元(Creating a Fragment) To c ...

  2. C语言之可重入函数 && 不可重入函数

    可重入函数 在 实时系统的设计中,经常会出现多个任务调用同一个函数的情况.如果这个函数不幸被设计成为不可重入的函数的话,那么不同任务调用这个函数时可能修改其他任 务调用这个函数的数据,从而导致不可预料 ...

  3. VCS仿真查看coverage

    VCS仿真查看coverage Design compiler & simulate #!/bin/csh -f setenv NOVAS_HOME /EDASynopsys/verdi3-I ...

  4. CSS Hack是什么意思

    CSS hack由于不同的浏览器,比如Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等,对CSS的解析认识不一样,因此会导致生成的页面效 ...

  5. ORACLE中将数字转换为英文

    SELECT LEVEL, to_char(to_date(LEVEL,'J'),'Jsp') FROM dual CONNECT 运行结果如下图所示:   说明: TO_CHAR(aDate,'JS ...

  6. MVC路由规则以及前后台获取Action、Controller、ID名方法

    1.前后台获取Action.Controller.ID名方法 前台页面:ViewContext.RouteData.Values["Action"].ToString(); Vie ...

  7. 逆向并查集 hrbust 1913

    #include<iostream> //由于拆除并查集的方法太难或者没有#include<cstdio> //可以先将所有没有拆的桥连接 再逆向操作 断开变成连接 反向输出# ...

  8. linux 线程备忘

    三种线程同步机制 •互斥锁 •信号量 •条件变量   pthread_t thread_id; 主要函数 pthread_create(),pthread_exit(),pthread_join(), ...

  9. jquery实现复选框全选反选

    实现原理: 给所有的复选框取相同的名字,当点击全选的时候把chenked属性全部设置为true;当点击全不选的时候把checked属性设置为false; 源代码如下: html代码: <form ...

  10. 学习ASP.NET的一些学习资源

    ASP.NET学习相关资源 当我们在决定选择哪一个编程语言来做web开发的时候,很难选择,php.java.python这些语言是开源的,有很多的学习资源,但是当我们决定学习ASP.NET的时候,微软 ...