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?

More than 3 years have passed since last update.

AtCoder Beginner Contest 208 参戦記

Last updated at Posted at 2021-07-04

AtCoder Beginner Contest 208 参戦記

ABC208A - Rolling Dice

1分半で突破. 最小値は1のゾロ目、最大値は6のゾロ目なので、その範囲かをチェックすればいい.

A, B = map(int, input().split())

if A <= B <= 6 * A:
    print('Yes')
else:
    print('No')

ABC208B - Factorial Yen Coin

6分で突破. n! は (n-1)! の倍数なので、大きい硬貨が使えるときに、小さい硬貨を使ったほうが枚数が少なくなるパターンはない. なので大きい硬貨から順に使えるかチェックしていけばいい.

P = int(input())

x = 3628800  # 10!
y = 10

result = 0
while P != 0:
    n = P // x
    if n != 0:
        result += n
        P -= n * x
    x //= y
    y -= 1
print(result)

ABC208C - Fair Candy Distribution

6分半で突破. KをNで割った余り人だけ1個余分にもらえる. インデックスと値の組を値でソートすれば、どの人が余分にもらえるか分かる.

N, K, *a = map(int, open(0).read().split())

result = [K // N] * N
for i, _ in sorted(enumerate(a), key=lambda x: x[1])[:K % N]:
    result[i] += 1
print(*result, sep='\n')
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?