#7697: 不知道問題出在哪


a8gp610 (貓眼)



import java.util.Scanner;


public class jac {

public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int f = scanner.nextInt();

if(f%4 == 0 & f%100 != 0){System.out.println("閏年");

}
else if(f%400 == 0){System.out.println("閏年");}
else
System.out.println("平年");


}}
 
在eclipse上執行沒有出錯
但是卻有WA輸出短少
是if的問題還是其他的?? 

#7698: Re:不知道問題出在哪


a8gp610 (貓眼)


 
import java.util.Scanner;


public class jac {

public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int f = scanner.nextInt();

if(f%4 == 0 & f%100 != 0){System.out.println("閏年");

}
else if(f%400 == 0){System.out.println("閏年");}
else
System.out.println("平年");


}}
 
在eclipse上執行沒有出錯
但是卻有WA輸出短少
是if的問題還是其他的?? 

奇怪的是

我把這個程式碼放進d067改閏年為a leap year

竟然過了 

#8029: Re:不知道問題出在哪


gt055667 (Bert)


 
import java.util.Scanner;


public class jac {

public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
 while (scanner.hasNext()) {   // 少了這一行
    
int f = scanner.nextInt();

if(f%4 == 0 & f%100 != 0){System.out.println("閏年");

}
else if(f%400 == 0){System.out.println("閏年");}
else
System.out.println("平年");


}}
 
在eclipse上執行沒有出錯
但是卻有WA輸出短少
是if的問題還是其他的?? 

奇怪的是

我把這個程式碼放進d067改閏年為a leap year

竟然過了