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?

AtCoder Beginner Contest 465の解答等の速報的まとめ

A問題

分数のまま計算するのは誤差が怖いので掛け算に直して計算する

A
a, b = map(int, input().split())
print("Yes" if a * 3 > b * 2 else "No")

B問題

範囲内に入る時間を計算して、入る時間とそれ以外で求める

B
x, y, l, r, a, b = map(int, input().split())

x_time = max((min(r, b) - max(l, a)), 0)
print(x_time * x + (b - a - x_time) * y)

C問題

後ろからシミュレーションすると端から確定していく

C
n = int(input())
s = input()

turned = False
ans = [0] * n
left, right = 0, n - 1
for i in range(n - 1, -1, -1):
    if s[i] == "o":
        turned ^= True

    if turned:
        ans[left] = i + 1
        left += 1
    else:
        ans[right] = i + 1
        right -= 1

print(*ans)

D問題

増加する方の操作は対象となる数が増えるので減らすだけで求める
減る方の操作を$X$と$Y$の双方から進めていって一致したときの計算回数が答えになる

D
for _ in range(int(input())):
    x, y, k = map(int, input().split())

    d = dict()
    d[x] = 0
    cnt = 0
    while x > 0:
        cnt += 1
        x //= k
        d[x] = cnt

    cnt = 0
    while y not in d:
        y //= k
        cnt += 1

    print(cnt + d[y])

E問題

桁DPなのはわかっていたが時間が足りなかった

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?