2
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 164 参戦記

Last updated at Posted at 2020-04-26

AtCoder Beginner Contest 164 参戦記

ABC164A - Sheep and Wolves

2分半で突破. 書くだけだったけど、コードテストが詰まってて、慌ててローカルでテストしたりして時間がかかった.

S, W = map(int, input().split())

if W >= S:
    print('unsafe')
else:
    print('safe')

ABC164B - Battle

2分半で突破. B問題なので、素直にシミュレートしても TLE しないので書くだけですね.

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

while True:
    C -= B
    if C <= 0:
        break
    A -= D
    if A <= 0:
        break

if A > 0:
    print('Yes')
else:
    print('No')

ABC164C - gacha

2分半で突破. set で distinct して個数を数えるだけ. C問題にしたって簡単すぎませんかね.

N = int(input())

print(len(set(input() for _ in range(N))))

ABC164D - Multiple of 2019

敗退.

追記: ABC158E - Divisible Substring を簡単にした問題なので、AtCoder Beginner Contest 158 参戦記を見てください. 復習をサボっていなかったら高パフォ取れてたのに…….

S = input()

S = S[::-1]
result = 0
t = [0] * 2019
m = 1
n = 0
for i in range(len(S)):
    t[n] += 1
    n += int(S[i]) * m
    n %= 2019
    result += t[n]
    m *= 10
    m %= 2019
print(result)
2
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
2
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?