熟练使用datetime模块,做这个题目易如反掌

import datetime
while True:
    try:
        date = input().split()
        year, month, day = int(date[0]), int(date[1]), int(date[2])
        date = datetime.datetime(year, month, day)
        which_day = date.strftime('%j').lstrip('0')
        print(which_day)
    except:
        break