A.py
A, B = map(str, input().split())
a = list(map(int, A))
b = list(map(int, B))
suma = sum(a)
sumb = sum(b)
if suma >= sumb:
print(suma)
else:
print(sumb)
B.py
N = int(input())
ab = [map(int, input().split()) for _ in range(N)]
a, b = [list(i) for i in zip(*ab)]
ans = 0
for i in range(N):
ai = a[i]
bi = b[i]
for j in range(i+1, N):
aj = a[j]
bj = b[j]
m = (bj-bi)/(aj-ai)
if m >= -1 and m <= 1:
ans += 1
print(ans)
C.py
N = int(input())
S = list(input() for i in range(N))
# print(S)
s1 = []
s2 = []
for s in S:
if s[0] == '!':
s2.append(s[1:])
else:
s1.append(s)
# print(s1, s2)
s1 = list(set(s1))
s2 = list(set(s2))
l = [k for k, v in Counter(s1 + s2).items() if v > 1]
if l == []:
print('satisfiable')
else:
print(l[0])
D.py
N = int(input())
X = 0
x = []
for i in range(N):
A, B = map(int, input().split())
X -= A
x.append(2*A + B)
print(X)
x.sort()
print(x)
ans = 0
while X <= 0:
X += x.pop()
ans += 1
print(ans)
Recommended Posts