d069: 文文的求婚--續集 (n 行版)
題目:http://zerojudge.tw/ShowProblem?problemid=d069
程式碼:
程式碼:
import java.util.Scanner;
public class d069 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();//n行
int[] year = new int[n];
for(int i=0;i<n;i++){
year[i] = sc.nextInt();
}
for(int i=0;i<n;i++){
if((year[i]%4==0 && year[i]%100!=0) || year[i]%400==0){
System.out.println("a leap year");
}else{
System.out.println("a normal year");
}
}
}
}
}

留言
張貼留言