| ||||||||||
| 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 | |||||||||
我的程序运行 Sample 时一点问题都没有,为什么会出错?
import java.util.*;
//import java.io.*;
//import java.math.*;
//import static java.lang.Character.*;
import static java.lang.System.*;
//import static java.util.Collections.*;
class Life{
static int a=23;
static int b=28;
static int c=33;
static int bca=5544;
static int acb=14421;
static int abc=1288;
int getMin(int aa,int bb,int cc,int today){
aa=a-aa%a;
bb=b-bb%b;
cc=c-cc%c;
int last=( aa*bca+bb*acb+cc*abc )% (a*b*c) ;
return a*b*c-last-today;
}
}
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(in);
Life l=new Life();
for(int i=1;;i++){
int aa=sc.nextInt();
int bb=sc.nextInt();
int cc=sc.nextInt();
int dd=sc.nextInt();
if( aa==-1 && bb==-1 && cc==-1 && dd==-1)
break;
out.println("Case " +i+ ": the next triple peak occurs in "+ l.getMin(aa,bb,cc,dd) +" days.");
}
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator