Help us understand the problem. What is going on with this article?

AtCoder Beginner Contest 155 参戦メモ

結果

A〜Cは完答。
D以降は解けず。以前と同様D以降のわからなかった問題は解答/参考になりそうな記事を随時追記することにします。
自分の回答なので、最適ではない場合もありますがご了承ください。

A問題

setによる重複の判定。
3つのうち、重複が2つあればYes, それ以外ならNoを返す。

ABC = list(map(int, input().split()))
if len(set(ABC)) == 2:
    print("Yes")
else:
    print("No")

B問題

各要素をiterationしながら、偶数であればあれば3または5の倍数かどうか判定する。

N = int(input())
A = list(map(int, input().split()))
ans = "APPROVED"
for a in A:
    if a%2 ==0:
        if a%3 == 0 or a%5 == 0:
            continue
        else:
            ans = "DENIED"
    else:
        pass
print(ans)

C問題

出現回数を数えて、出現回数が最も多い単語を抽出し出力。

from collections import Counter
import numpy as np
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
candidate = sorted(np.array(list(c.keys()))[np.array(list(c.values())) == max(c.values())])
for i in range(len(candidate)):
  print(candidate[i])

D問題

E問題

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした