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

麻烦谁能帮忙看下,为什么超时,感觉已经没法再减了,非常感激

Posted by Kuroro at 2010-11-20 11:34:38 on Problem 1006
import java.util.Scanner;

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

		//int b1 = 5544, b2= 14421, b3= 1288;
		while(in.hasNext())
		{
			int p= in.nextInt();
			int e= in.nextInt();
			int i= in.nextInt();

			int d= in.nextInt();

			if( p == -1&& e == -1&& i == -1&& d== -1 )break;
			//中国剩余定理
			int n= (5544*p+14421*e+1288*i-d)%21252;
			if (n <= 0) {   
                n = 21252 + n;   
            }  
			System.out.printf("Case %d: the next triple peak occurs in %d days.\n", count++, n);
		}
	}
}

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