参考代码:
import java.time.LocalDate; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); LocalDate a = LocalDate.of(1, 1, 1); LocalDate b = LocalDate.of(2, 1, 1); int week = scanner.nextInt(); while(a.isBefore(b)) { a = a.plusDays(1); week = (week + 1) % 7; if(a.getDayOfMonth() == 13 && week == 5) System.out.println(a.getMonthValue()); } } }
0.0分
7 人评分