Last time It's the second day.
#2 Problem
** Thoughts ** Implemented according to the formula in question. Please note that January and February are calculated as March and 14 of the previous year. Gaussian symbols can also be implemented in Python using the math.floor function. (Addition) I changed it because it can be done with // without using math.floor.
#import math #Use floor function
y = int(input())
m = int(input())
d = int(input())
seed = 735369
def cal(y,m,d):
return 365 * y + y//4 - y//100 + y//400 + 306*(m+1)//10 + d - 429
#return 365 * y + math.floor(y/4) - math.floor(y/100) + math.floor(y/400) + math.floor(306*(m+1)/10) + d - 429
if m <= 2:
y -= 1
m += 12
ans = cal(y,m,d)
print(seed - ans)
else:
ans = cal(y,m,d)
print(seed - ans)
Old problems have different tendencies than current ones, so it's fun to solve. Then to the next time
Recommended Posts