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

我的程序运行 Sample 时一点问题都没有,为什么会出错?

Posted by tactoth at 2006-05-27 07:42:51 on Problem 1006
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:
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