ABC161 - Atcoder/Python精進のための解説メモ
2022/12/27
ABC161 - A.ABC Swap
AtCoder公式 | ABC161 - A.ABC Swap解答
b, c, a = map(int, input().split())
print(a, b, c)
要点解説メモ
- 受け取り時点で入れ替えても良いかも
ABC161 - B.Popular Vote
AtCoder公式 | ABC161 - B.Popular Vote解答
n, m = map(int, input().split())
aaa = list(map(int, input().split()))
border = sum(aaa) / (4 * m)
cnt = 0
for a in aaa:
if a >= border:
cnt += 1
print('Yes' if cnt >= m else 'No')
要点解説メモ
- シンプルにやる
ABC161 - C.Replacing Integer
AtCoder公式 | ABC161 - C.Replacing Integer解答
n, k = map(int, input().split())
n1 = n % k
n2 = abs(n % k - k)
print(min(n1, n2))
要点解説メモ
- 何回でも操作してよいので、0付近まで操作した場合の考察をする
- 0の前後どちらかが最小となるので、比較しておしまい
ABC161 - D.
AtCoder公式 | ABC161 - D.解答
まだ解いていません