Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
有人能帮看下是什么原因导致Runtime Answer 吗?已经迷糊了。。import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { static double N = (Math.sqrt(5.0) + 1.0) / 2; public static void main(String[] args) { long a = 0,b = 0; String str; boolean flag = true; BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); while(true){ str = null; flag = true; a = 0; b = 0; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } Scanner sc = new Scanner(str); while(flag) { a = sc.nextInt(); b = sc.nextInt(); flag = false; } if(a > b) { a = a ^ b; b = a ^ b; a = a ^ b; } double j = b - a; double d = j * N; if(a == (int)d){ System.out.println("0"); }else{ System.out.println("1"); } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator