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

1006 java 为啥一直是wrong answer

Posted by 247231168 at 2015-12-05 15:11:46
程序如下

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
	for(int a=1;a>0;a++){
    int p=in.nextInt(),e=in.nextInt(),i=in.nextInt(),d=in.nextInt(),m=0,n=0,l=0,min;
    if(p==-1){
    	if(e==-1){
    		if(i==-1){
    			if(d==-1){
    				
    				break;
    			}
    		}
    	}
    }
 for(int q=1;q!=0 ;q++  ){
    if(33*28*q%23==1){
    	m=33*28*q;
    	q=-1;
    }
 }
 for(int q=1;q!=0 ;q++  ){
	    if(33*23*q%28==1){
	    	 n=33*23*q;
	    	q=-1;
	    }
	 }
 for(int q=1;q!=0 ;q++  ){
	    if(23*28*q%33==1){
	    	l=23*28*q;
	    	q=-1;
	    }
	 }
  min=m*p+n*e+l*i;
  min=min%(33*28*23);
		for(int j=1;min<21252;j++){
			if(min>d){
				System.out.print("\n"+"Case"+" "+ a+": the next triple peak occurs in "+(min-d)+" days.")	   ;
				break;
			}
			min+=23*28*33;
		}
		if(min>21251){System.out.print("\n"+"Case"+ " "+a+": the next triple peak occurs in "+(21252-d)+ " 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