解题思路:
注意事项:
参考代码:
import java.util.Calendar;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, n);
int count=0;
for (int i = 1; i <=12; i++) {
cal.set(Calendar.MONTH,i-1);
cal.set(Calendar.DAY_OF_MONTH, 13);
int k=cal.get(Calendar.DAY_OF_WEEK)-1;
if(k==5)count++;
}
System.out.println(count);
}
}
0.0分
0 人评分