相关月

GitHub跳转原题关系图返回列表

本地题面缓存已迁移,解析内容待补充。

OJ: noi_openjudge

题目 ID: ch0113-43

难度:未知

标签:python

日期: 2026-07-30 23:01

题意

完整题面见同目录的 problem.md

思路

代码

Python代码

python
def is_leap(year: int) -> bool:
    return year % 400 == 0 or year % 4 == 0 and year % 100 != 0


case_count = int(input())
for _ in range(case_count):
    year, first_month, second_month = map(int, input().split())
    month_lengths = [31, 28 + is_leap(year), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    starts = [0]
    for length in month_lengths:
        starts.append(starts[-1] + length)
    print("YES" if (starts[first_month - 1] - starts[second_month - 1]) % 7 == 0 else "NO")

复杂度

总结