Solve ABC166 A ~ D with Python

Introduction

Today was 4 completes from A to D. I was troubled by C today too ()

A problem

Problem

** Thoughts ** if

s = input()

if s == 'ABC':
    print('ARC')
else:
    print('ABC')

B problem

Problem

** Thoughts ** Input was a little troublesome. Make a list of N people and see if you have sweets.

n, k = map(int,input().split())
d = []
a = []
for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
check = [False] * n
for i in range(k):
    for j in a[i]:
        check[j-1] = True

ans = 0
for i in range(n):
    if not check[i]:
        ans += 1
print(ans)

C problem

Problem

** Thoughts ** Make a list of the number of connected roads and check the size. I did not process when the height is the same and 3WA came out. I will not forgive you.

n, m = map(int,input().split())
h = list(map(int,input().split()))
ab = [(list(map(int,input().split()))) for _ in range(m)]

path = [0] * n
check = [0] * n
for i in range(m):
    path[ab[i][0]-1] += 1
    path[ab[i][1]-1] += 1
    if h[ab[i][0]-1] < h[ab[i][1]-1]:
        check[ab[i][1]-1] += 1
    elif h[ab[i][0]-1] == h[ab[i][1]-1]:
        continue
    else:
        check[ab[i][0]-1] += 1

ans = 0
for i in range(n):
    if path[i] == check[i]:
        ans +=1

print(ans)

D problem

Problem

** Thoughts ** Mathematics? You don't know. I searched all over $ -1000 <= a, b <= 1000 $.

x = int(input())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i ** 5 - j ** 5 == x:
            print(i,j)
            quit()

Summary

It is not good because the details are overlooked and pena grows and time is lost. Again, C and D were solved sooner. It is mortifying. See you again, good night.

Recommended Posts

Solve ABC166 A ~ D with Python
Solve AtCoder ABC168 with python (A ~ D)
Solve ABC163 A ~ C with 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
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Solve ABC165 A, B, D in Python
Solve AtCoder ABC166 with python
Solve ABC175 D in Python
AtCoder ABC 182 Python (A ~ D)
Solve AtCoder ABC 186 with Python
[AtCoder] Solve A problem of ABC101 ~ 169 with Python
Solve A ~ D of yuki coder 247 with python
I wanted to solve the ABC164 A ~ D problem with Python
Solve ABC036 A ~ C in Python
Solve ABC037 A ~ C in Python
Solve with Ruby and Python AtCoder ABC133 D Cumulative sum
Solve ABC175 A, B, C in Python
ABC 157 D --Solve Friend Suggestions in Python!
I wanted to solve ABC160 with Python
I wanted to solve ABC172 with Python
Solve AtCoder 167 with python
Solve Sudoku with Python
Solve ABC169 in Python
Solve POJ 2386 with python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
[Python] Solve equations with sympy
AtCoder ABC 177 Python (A ~ E)
ABC163 C problem with python3
AtCoder ABC 178 Python (A ~ E)
Create 3d gif with python3
Solve ABC176 E in Python
AtCoder ABC 176 Python (A ~ E)
Make a fortune with Python
Create a directory with python
ABC188 C problem with python3
ABC187 C problem with python
A story about making 3D space recognition with Python
Solve Atcoder ABC176 (A, B, C, E) in Python
[Python] How to create a 2D histogram with Matplotlib
Create a 2d CAD file ".dxf" with python [ezdxf]
[AtCoder explanation] Control the A, B, (C), D problems of ABC165 with Python!
[AtCoder explanation] Control the A, B, C, D problems of ABC183 with Python!
Solve with Ruby and Python AtCoder ABC084 D Cumulative sum of prime numbers
[AtCoder explanation] Control the A, B, C, D problems of ABC181 with Python!
[Python] What is a with statement?
solver> Link> Solve Excel Solver with python
A python graphing manual with Matplotlib.
[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
3D skeleton structure analysis with Python
ABC127 A, B, C Explanation (python)
Let's make a GUI with python.
Solving with Ruby and Python AtCoder ABC151 D Breadth-first search
A collection of competitive pro techniques to solve with Python
ABC166 in Python A ~ C problem
Solve Atcoder ABC169 A-D in Python
Create a virtual environment with Python!