d071: 文文的求婚--續集 (EOF 版)
題目:http://zerojudge.tw/ShowProblem?problemid=d071
程式碼:
import java.util.Scanner;
public class a071 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int year = sc.nextInt();//輸入年分
if( ((year % 4) == 0 && (year % 100) != 0) || (year % 400) == 0)
System.out.println("a leap year");
else
System.out.println("a normal year");
}
}
}

留言
張貼留言