https://atcoder.jp/contests/abc127/tasks/abc127_a
a,b = map(int,input().split())
if 13 <= a:
print(b)
elif 6 <= a <= 12:
print(b//2)
else:
print(0)
Determine the age zone with the if statement and output the amount.
https://atcoder.jp/contests/abc127/tasks/abc127_b
r,d,x = map(int,input().split())
for i in range(10):
print(r*x-d)
x = r*x-d
Recurrence formula (applying the previous calculation result to the next calculation result) problem
https://atcoder.jp/contests/abc127/tasks/abc127_c
n,m = map(int,input().split())
l = [0]*m
r = [0]*m
for i in range(m):
l[i],r[i] = map(int,input().split())
if min(r)-max(l) < 0:
print(0)
else:
print(min(r)-max(l)+1)
By saying that the sections overlap in all The key between the largest l and the smallest r is applicable.
Recommended Posts