| ||||||||||
| 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 | |||||||||
麻烦谁能帮忙看下,为什么超时,感觉已经没法再减了,非常感激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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator