UVa11646 - Athletics Track(水题)
来源:互联网 发布:node 命令行多步执行 编辑:程序博客网 时间:2024/04/29 04:31
London Olympics is approachingvery shortly – in just 3 years. Three years might not sound as that small atime to say ‘just’, but it is indeed for those who have to organize the competition.There are so many things to do – preparing the venues, building the Olympicvillage for accommodating athletes and officials, improving the transportationof the entire city as the venues are located all over the city and also therewill be great number of tourists / spectators during the Olympics.
One of the most important tasksis to build the stadium. You are appointed as a programmer to help things outin certain matters – more specifically in designing and building the athleticstracks. After some study, you find out that athletics tracks have a generalshape of a rectangle with two sliced circles on two ends. Now the turf that isplaced inside this rectangle is prepared elsewhere and comes in differentshapes – different length to width ratios. You know one thing for certain –your track should have a perimeter of 400 meters. That’s the standard lengthfor athletics tracks. You are supplied with the design parameter – length towidth ratio. You are also told that the sliced circles will be such that theyare part of the same circle. You have to find the length and width of therectangle.
Input
There will be at most 1000 test cases. Each test case will be given in oneline. It will contain ratio of the length and width of the rectangle in theformat – “a : b”. Here, a and b will be integers and both will be between 1 and1000 (inclusive).
Output
For each test case, output a line in the following format –“Case n: L W” where n is the case no (starting from 1) and L and W are lengthand width of the rectangle (in meters) respectively. You can output as manydigits as you want after the decimal point. Output will be verified by avalidator for 1E-5 precision.
Sample Input Output for SampleInput
3 : 2
5 : 4
Case 1: 117.1858168913 78.1238779275
Case 2: 107.2909560477 85.8327648381
import java.io.FileInputStream;import java.io.BufferedInputStream;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.util.Scanner;public class Main implements Runnable{private static final boolean DEBUG = false;private PrintWriter cout;private Scanner cin;private int a, b;private int cas = 1;private void init(){try {if (DEBUG) {cin = new Scanner(new BufferedInputStream(new FileInputStream("d:\\OJ\\uva_in.txt")));} else {cin = new Scanner(new BufferedInputStream(System.in));}cout = new PrintWriter(new OutputStreamWriter(System.out));} catch (Exception e) {e.printStackTrace();}}private boolean input(){if (!cin.hasNextInt()) return false;a = cin.nextInt();cin.next();b = cin.nextInt();return true;}private void solve(){double theta = Math.atan2(b, a) * 2;double x = 400 / (Math.sqrt(a * a + b * b) * theta + 2 * a);cout.print("Case " + cas++ + ": ");cout.println(x * a + " " + x * b);cout.flush();}public void run(){init();while (input()) {solve();}}public static void main(String[] args){new Thread(new Main()).start();}}
- UVa11646 - Athletics Track(水题)
- UVA11646 - Athletics Track
- UVA 11646 Athletics Track
- uva 11646 - Athletics Track
- UVa 11646 - Athletics Track
- uva 11646 - Athletics Track
- UVa 11646 Athletics Track
- UVA 11646 - Athletics Track
- UVA 11646 Athletics Track
- UVA 11646 Athletics Track
- UVA 11646 Athletics Track
- UVa 11646 Athletics Track(几何)
- Athletics Track - UVa 11646 几何
- uva 11646 - Athletics Track(几何)
- 入门题 UVA 11646 Athletics Track
- UVa 11646 - Athletics Track(几何)
- UVA - 11646 - Athletics Track (计算几何~)
- UVA 11646 - Athletics Track(计算几何)
- Haar特征描述子及其代码实现
- GreenDao 执行sql语句
- mtp usb驱动 v4.9 最新版
- 使用 HttpSendRequest() 上报数据
- Flip Game (poj 1753)枚举+二进制
- UVa11646 - Athletics Track(水题)
- (1)JS简介
- hdu 5000 Clone(背包)
- 理解Android的手势识别
- unexpected operator--shell script
- 开通微信公众平台搭建“微网站”的过程记录
- ACM整理(五)——1482:玛雅人的密码
- 64位WIN7下安装MPICH2
- 使用 SendRequestEx() 上报数据