Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

有人能帮看下是什么原因导致Runtime Answer 吗?已经迷糊了。。

Posted by jlsf_zym at 2008-10-09 15:52:53 on Problem 1067
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator