AtCoder ABC174 This is a summary of the problems of AtCoder Beginner Contest 174, which was held on 2020-08-02 (Sun), in order from problem A, taking into consideration the consideration. The first half deals with problems up to ABC. The problem is quoted, but please check the contest page for details. Click here for the contest page Official commentary PDF
Problem statement You turn on the air conditioner only when and only when the room temperature is above $ 30 $. The current room temperature is $ X $ degrees. Do you want to turn on the air conditioner? Output Output'Yes' if you turn on the air conditioner, and'No' if you don't.
abc174a.py
x = int(input())
if x >= 30:
print("Yes")
else:
print("No")
Problem statement There are $ N $ points on the $ 2 $ dimensional plane. The coordinates of the $ i $ th point are $ (X_i, Y_i) $. How many of these points have a distance of less than $ D $ from the origin? The distance between the point at the coordinate $ (p, q) $ and the origin is represented by $ \ sqrt {p ^ 2 + q ^ 2} $.
I don't like the error in the calculation of the square root, so I used $ p ^ 2 + q ^ 2 \ leqq D ^ 2 $, which is the square of both sides of $ \ sqrt {p ^ 2 + q ^ 2} \ leqq D $. Judgment was made.
abc174b.py
n, d = map(int, input().split())
d = d * d
count = 0
for i in range(n):
x, y = map(int, input().split())
if x * x + y * y <= d:
count+= 1
print(count)
Problem statement Takahashi likes multiples of $ K $ and $ 7 $. What is the first multiple of $ K $ to appear in the $ 7,77,777,… $ sequence? If it does not exist, output'-1' instead.
I had a hard time.
I quickly realized that there were no multiples of $ 5 $ and $ 2 $, but I personally found it difficult.
I've spent a lot of time investigating the properties of the repunit.
My personal interpretation is that the sequence $ 7,77,777,… $ has the first term $ a_1 = 7 $.
abc174c.py
k = int(input())
if k % 2 == 0 or k % 5 == 0:
print(-1)
else:
c = 7
count = 1
while True:
if c % k == 0:
print(count)
break
else:
c = (10 * c + 7) % k
count += 1
This is the end of the first half. Recently, the official commentary has been described very carefully, so I hope you can refer to that for the detailed solution. Thank you for reading to the end of the first half.
The second half will explain the DEF problem. Continued in the second half.
Recommended Posts