0
1

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.

abc155参戦レポ

Posted at

A

地味に実装が面倒臭かった。解説を聞いて反例を取り除けば実装が簡単そう。私はCounterを使った。

from collections import Counter
a = Counter(map(int,input().split()))
if 2 in a.values():
    print("Yes")
else:
    print("No")

B

入力数の上限的に実装はそこまで難しくない。if文を一つにまとめられるようになりたい。

N = int(input())
A = list(map(int,input().split()))
for a in A:
    if a % 2 == 1:
        continue
    if a % 3 != 0 and a % 5 != 0:
        print("DENIED")
        exit()
print("APPROVED")

C

もっとも出現回数が多い回数を変数に保存。その後ソートした文字列のうち、maxの回数と一致するもののみを表示。


from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
S = S.most_common()
most_count = S[0][1]
S.sort()
for i in range(len(S)):
    if S[i][1] == most_count:
        print(S[i][0])

D

問題文を見て嫌な予感がしたので、順位表へ。ほとんどの人がDよりもEを優先して解いていたのでスキップ

E

Dを飛ばしたは良いが実装できず。これは良くない。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?