#2443: 哪裡錯了!?


a94bjo4dk4 (Mission 6)


import java.util.Scanner;
public class d466 {
 public static void main(String[] args){
  Scanner input=new Scanner(System.in);
  while(input.hasNext()) {
   int year=input.nextInt();
   int month=input.nextInt();
   int day=input.nextInt();
   String d=day==1?"day":"days";
   
   if(year%4==0){
    if((month==3||month==5||month==7||month==8||month==10||month==12)&&day<=31){
     System.out.printf("It is %d %s in %d\n",(31*month-(month/2)-32+day),d,year);//(month-1)*31)-2-(month/2-1)+day
    }else if((month==4||month==6||month==9||month==11)&&day<=30){
     System.out.printf("It is %d %s in %d\n",(31*month-(month/2)-31+day),d,year);//(month-1)*31)-1-(month/2-1)+day
    }else if(month==1&&day<=31){
     System.out.printf("It is %d %s in %d\n",day,d,year);
    }else if(month==2&&day<=29){
     System.out.printf("It is %d %s in %d\n",31+day,d,year);
    }else{
     System.out.println("Error");
    }
   }
   if(year%4!=0){
    if((month==3||month==5||month==7||month==8||month==10||month==12)&&day<=31){
     System.out.printf("It is %d %s in %d\n",(31*month-(month/2)-32+day),d,year);//(month-1)*31)-2-(month/2-1)+day
    }else if((month==4||month==6||month==9||month==11)&&day<=30){
     System.out.printf("It is %d %s in %d\n",(31*month-(month/2)-31+day),d,year);//(month-1)*31)-1-(month/2-1)+day
    }else if(month==1&&day<=31){
     System.out.printf("It is %d %s in %d\n",day,d,year);
    }else if(month==2&&day<=28){
     System.out.printf("It is %d %s in %d\n",31+day,d,year);
    }else{
     System.out.println("Error");
    }
   }
  }
 }  
}

 

與正確輸出不相符(line:8)
您的答案為: It is 60 d ...略
正確答案為: Error
#2444: Re:哪裡錯了!?


example (學姊)


 

與正確輸出不相符(line:8)
您的答案為: It is 60 d ...略
正確答案為: Error

閏年的判定 西元年被4整除且不被100整除,或被400整除者 from a004 文文的求婚