AtCoder ABC188 Python

A.py


X, Y = map(int, input().split())

if max(X, Y) - min(X, Y) < 3:
    print("Yes")
else:
     print("No")

B.py


N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(N):
    ans += A[i]*B[i]

if ans == 0:
    print('Yes')
else:
    print('No')

C.py


N = int(input())
A = list(map(int, input().split()))

l = [A]

for i in range(1, N+1):
    # print('---')
    a = []
    for j in range(1, 2**(N-i)+1):
        # print(j*2-1, j*2)
        a.append(max(l[i-1][j*2-1-1], l[i-1][j*2-1]))
    l.append(a)

p = min(l[-2][0], l[-2][1])
print(A.index(p)+1)

D.py


N, C = map(int, input().split())

event = []
for i in range(N):
    a, b, c = map(int, input().split())
    a -= 1
    event.append([a, c])
    event.append([b, -c])

event.sort()
# print(event)
ans = 0
fee = 0
t = 0
    
for x, y in event:
    if x != t:
        ans += min(C, fee) * (x - t)
        t = x
    fee += y

print(ans)

Recommended Posts

AtCoder ABC 174 Python
AtCoder ABC188 Python
AtCoder ABC 175 Python
atCoder 173 Python
AtCoder ABC176
AtCoder ABC177
AtCoder ABC 177 Python (A ~ E)
Solve AtCoder ABC166 with python
AtCoder ABC 178 Python (A ~ E)
Atcoder ABC164 A-C in Python
Atcoder ABC167 A-D in Python
Atcoder ABC165 A-D in Python
Atcoder ABC166 A-E in Python
AtCoder ABC 182 Python (A ~ D)
Solve AtCoder ABC 186 with Python
Atcoder ABC169 A-E in Python
AtCoder ABC177 A-D in python
Beginner ABC154 (Python)
Solve Atcoder ABC169 A-D in Python
Beginner ABC155 (Python)
Solved AtCoder ABC 114 C-755 with Python3
Template AtCoder ABC 179 Python (A ~ E)
Beginner ABC157 (Python)
Python beginner Atcoder memo @ KEYENCE 2020, ABC problem
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Solve AtCoder ABC168 with python (A ~ D)
Daily AtCoder # 36 in Python
Daily AtCoder # 2 in Python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Daily AtCoder # 53 in Python
Daily AtCoder # 33 in Python
Daily AtCoder # 7 in Python
Daily AtCoder # 24 in Python
Daily AtCoder # 37 in Python
Solve AtCoder 167 with python
Daily AtCoder # 42 in Python
Daily AtCoder # 21 in Python
Daily AtCoder # 17 in Python
Daily AtCoder # 38 in Python
Daily AtCoder # 54 in Python
Daily AtCoder # 11 in Python
Daily AtCoder # 15 in Python
Daily AtCoder # 47 in Python
Daily AtCoder # 13 in Python
Daily AtCoder # 40 in Python
Daily AtCoder # 10 in Python
Daily AtCoder # 5 in Python
Daily AtCoder # 39 in Python
Automate AtCoder submission (Python)
Atcoder ABC115 Past Exercises
Daily AtCoder # 20 in Python
Daily AtCoder # 19 in Python
Daily AtCoder # 52 in Python
Daily AtCoder # 3 in Python
Daily AtCoder # 14 in Python
Daily AtCoder # 50 in Python
Daily AtCoder # 26 in Python
Daily AtCoder # 4 in Python
Daily AtCoder # 43 in Python