ABC145 - Atcoder/Python精進のための解説メモ
2022/12/27
ABC145 - A.Circle
AtCoder公式 | ABC145 - A.Circle解答
a = int(input())
print(int(a ** 2))
要点解説メモ
- シンプルにやる
ABC145 - B.Echo
AtCoder公式 | ABC145 - B.Echo解答
n = int(input())
s = input()
if n % 2 == 1:
print('No')
else:
t = n // 2
if s[:t] == s[t:]:
print('Yes')
else:
print('No')
要点解説メモ
- スライスして比較
- 奇数文字数の場合があるので注意
ABC145 - C.Average Length
AtCoder公式 | ABC145 - C.Average Length解答
import math
import itertools
n = int(input())
xyxy = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for xy1, xy2 in itertools.permutations(xyxy, 2):
x1, y1 = xy1
x2, y2 = xy2
ans += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(ans / n)
要点解説メモ
- わりと普通にやるだけな感じ
ABC145 - D.
AtCoder公式 | ABC145 - D.解答
まだ解いていません