ABC170 - Atcoder/Python精進のための解説メモ
2022/12/27
ABC170 - A.Five Variables
AtCoder公式 | ABC170 - A.Five Variables解答
xxx = list(map(int, input().split()))
ans = 0
for i in range(5):
if xxx[i] == 0:
ans = i + 1
print(ans)
要点解説メモ
- やるだけ
ABC170 - B.Crane and Turtle
AtCoder公式 | ABC170 - B.Crane and Turtle解答
x, y = map(int, input().split())
ans = 'No'
for i in range(x + 1):
tmp = 2 * i + 4 * (x - i)
if tmp == y:
ans = 'Yes'
print(ans)
要点解説メモ
- たかだかxは100なので全探索すれば良い
ABC170 - C.Forbidden List
AtCoder公式 | ABC170 - C.Forbidden List解答
x, n = map(int, input().split())
ppp = []
if n != 0:
ppp = list(map(int, input().split()))
ans = 0
for i in range(101):
if x - i not in ppp:
ans = x - i
break
if x + i not in ppp:
ans = x + i
break
print(ans)
要点解説メモ
- 簡単な問題なのでパターン漏れなく実装できるかを問われている感
- 端の数とかで試行してみて高々ここまでだよねみたいに、レンジを把握して実装する
ABC170 - D.
AtCoder公式 | ABC170 - D.解答
まだ解いていません