AtCoder Beginner Contest 141 過去問 (A~C)

参照

atcoder.jp

A問題

正直綺麗なコードとは言えません。

now=input()
if now=='Sunny': print('Cloudy')
elif now=='Cloudy': print('Rainy')
else: print('Sunny')

B問題

問題なく。

ss=input()
for i,s in enumerate(ss):
  if (i+1)%2!=0 and s=='L':
    print('No')
    exit(0)
  elif (i+1)%2==0 and s=='R':
    print('No')
    exit(0)
print('Yes')

C問題

1≤Q≤10**5だったので、1重ループまでは許されています。
(実施した全ての問題数Q-個人の正解数t)>初期から与えられた正解数Kにより、
脱落 or 生き残りの判別を行いました。

n,k,q = map(int, input().split())
all_=[0]*n
for i in range(q):
  a=int(input())
  all_[a-1]+=1

for t in all_:
  if (q-t)<k: print('Yes')
  else: print('No')