您的位置:首页 > 其它

ZOJ-1394

2013-12-16 11:22 309 查看
import java.util.Scanner;

public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

String line = sc.nextLine();

while (!"ENDOFINPUT".equals(line.trim()))
{
while ("START".equals(line.trim()))
{
String s = sc.nextLine();
while (!"END".equals(s))
{
System.out.println(caculate(s));
s = sc.nextLine();
}
line = sc.nextLine();
}
}
}

static String caculate(String line)
{
String[] ss = line.split(" ");
int x = Integer.parseInt(ss[0]);
int y = Integer.parseInt(ss[1]);
int z = Integer.parseInt(ss[2]);

int angle = z > 180 ? 360 - z : z;
double distance = 3.14159 * x * angle / 90;
int travel = y * 5;
if (travel >= distance)
return "YES " + (int) ((travel - distance) / 5);
else
return "NO " + travel;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: