ABC082 をPythonで解く

atcoder.jp

A~Cを解いた。

A - Round Up the Mean

import numpy as np
A,B = map(int,input().split())
ans = int(np.ceil((A+B)/2))
print(ans)

 

B - Two Anagrams

s = input()
t = input()

sl = list(s)
sl.sort()
tl = list(t)
tl.sort()
tl=tl[::-1]
S="".join(sl)
T="".join(tl)
if S<T:
    ans ='Yes'
else:
    ans = 'No'
print(ans)

C - Good Sequence

N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
ans = 0
for k,v in Counter(A).items():
    if v!=k and k>v:
        ans+=v
    elif v!=k and k<v:
        ans+=v-k
print(ans)