Codeforces Round #362 (Div. 2) A. Pineapple Incident
problem
t,s,xが与えられる。 時刻t,t+s,t+s+1,t+2s+1,t+3s+1,t+3s+1,…に犬が鳴くのだが、時刻xはそのような犬が鳴く時刻であるか答えよ。
implementation
t,(t+s,t+s+1),(t+2s,t+2s+1),…と見たが、(t,t+s),(t+s+1,t+2s),…としたほうがよかった。
#!/usr/bin/env python3
t, s, x = map(int,input().split())
ans = False
if x == t:
ans = True
elif x >= t+s and (x - t) % s == 0:
ans = True
elif x >= t+s and (x - t) % s == 1:
ans = True
print(ans and 'YES' or 'NO')