0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[ABC460] ABC 460(Atcoder Beginner Contest)のA~C(A,B,C)問題をPythonで解説(復習)

0
Posted at

[ABC460] ABC 460(Atcoder Beginner Contest)のA~C(A,B,C)問題をPythonで解説(復習)

合計回答時間:40分

A問題

自分の回答

かかった時間:5分

# 問題文

# 方針

N,M = map(int,input().split())

count = 0
while M != 0:
    count += 1
    x = N % M
    M = x

print(count)

B問題

自分の回答

かかった時間:10分

# 問題文
# 円が2つある

# 方針
# 円が重なる、または触れるなら共有点を持つということ
# 2つの円のそれぞれの中心の距離<=2つの円の半径の合計 なら共有点を持つのでは
# |r₁ − r₂| < d < r₁ + r₂

T = int(input())
for i in range(T):
    X1,Y1,R1,X2,Y2,R2 = map(int,input().split())
    d_sq = (X2-X1)**2+(Y2-Y1)**2
    if (abs(R1-R2)**2 <= d_sq) and (d_sq <= (R1+R2)**2):
        print('Yes')
    else:
        print("No")

C問題

自分の回答

かかった時間:20分

# 問題文
# 2個のシャリと3個のネタ
# B <= 2A

# 方針
# 一つのシャリには一つのネタ
# シャリやネタは複数使用できない
# ソートして貪欲法でいけそう

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

A.sort()
B.sort()

indB = 0
ans = 0
for a in A:
    if indB == M:
        break
    if B[indB] <= 2*a:
        indB += 1
        ans += 1
print(ans)

補足

関係するリンク(参考文献など)

今回のコンテスト

回答の正当性は保証できません。ベストエフォート方式です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?