参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int week = scanner.nextInt(); int []month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int day = 1; for(int i = 0; i < 12; i++) { int mday = 1; while(mday <= month[i]) { mday++; week = (week + 1) % 7; if(mday == 13 && week == 5) System.out.println(i + 1); } } } }
0.0分
7 人评分