Solve AtCoder ABC 186 with Python

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

Solve AtCoder ABC166 with python
Solve AtCoder ABC 186 with Python
Solve AtCoder 167 with python
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Solve AtCoder ABC168 with python (A ~ D)
[AtCoder] Solve A problem of ABC101 ~ 169 with Python
AtCoder ABC187 Python
AtCoder ABC188 Python
AtCoder ABC 175 Python
Solve ABC163 A ~ C with Python
Solve ABC166 A ~ D with Python
Solve Atcoder ABC169 A-D in Python
Solve ABC168 A ~ C with Python
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Solve with Ruby and Python AtCoder ABC133 D Cumulative sum
I wanted to solve ABC160 with Python
Solve Sudoku with Python
Solve ABC169 in Python
Solve POJ 2386 with python
I wanted to solve ABC172 with Python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
Solve "AtCoder version! Ant book (beginner)" with Python!
[Python] Solve equations with sympy
AtCoder ABC 177 Python (A ~ E)
Light blue with AtCoder @Python
AtCoder ABC 178 Python (A ~ E)
Atcoder ABC164 A-C in Python
Solve ABC176 E in Python
AtCoder ABC 176 Python (A ~ E)
Atcoder ABC167 A-D in Python
Solve ABC175 D in Python
Atcoder ABC165 A-D in Python
AtCoder ABC 182 Python (A ~ D)
ABC188 C problem with python3
ABC187 C problem with python
Atcoder ABC169 A-E in Python
AtCoder ABC177 A-D in python
atCoder 173 Python
AtCoder ABC176
Solve Atcoder ABC176 (A, B, C, E) in Python
AtCoder ABC177
Solve with Ruby and Python AtCoder ABC084 D Cumulative sum of prime numbers
solver> Link> Solve Excel Solver with python
Solve ABC036 A ~ C in Python
Template AtCoder ABC 179 Python (A ~ E)
Solve ABC037 A ~ C in Python
[AtCoder explanation] Control ABC180 A, B, C problems with Python!
[AtCoder explanation] Control ABC188 A, B, C problems with Python!
Solving with Ruby and Python AtCoder ABC178 D Dynamic programming
Solving with Ruby and Python AtCoder ABC151 D Breadth-first search
[AtCoder explanation] Control ABC158 A, B, C problems with Python!
Solving with Ruby and Python AtCoder ABC011 C Dynamic programming
Solving with Ruby and Python AtCoder ABC153 E Dynamic programming
Solve AtCoder Problems Boot camp for Beginners (Medium 100) with python
[AtCoder explanation] Control ABC164 A, B, C problems with Python!
[AtCoder explanation] Control ABC168 A, B, C problems with Python!
Beginner ABC154 (Python)
Beginner ABC156 (Python)
FizzBuzz with Python3