This is an article for beginners who wishes to solve the D problem. This time, I was able to solve the three questions A, B, and C relatively quickly, but I stumbled on D.
A The answer is too much.
N, W = map(int, input().split())
print(N // W)
B I wrote some very inefficient code. We will refer to your answers.
L = []
H, W = map(int, input().split())
for _ in range(H):
S = list(map(int, input().split()))
L.append(S)
mx = 100
for l in L:
ml = min(l)
if ml < mx:
mx = ml
ans = 0
for l in L:
for i in l:
diff = i - mx
ans += diff
print(ans)
C This was a pretty good feeling.
N = int(input())
t = len(str(N))
# for i in t:
L = []
for i in range(1, N+1):
ten = str(i)
if '7' in ten:
L.append(i)
eight = oct(i)
if '7' in eight:
L.append(i)
seven = len(set(L))
print(N - seven)
Recommended Posts