Divide by Zero 2017 and Codeforces Round #399 (Div.1 + Div.2, combined)
はい。
http://codeforces.com/contest/768
A. Oath of the Night's Watch
ざっくりと大意
・Jonはstewardsを支援する。
・1,5は1未満のがいないので支援できない、1,2,5は2未満と2より大きいのがいるので1支援できる。
Python3
n=int(input()) a=[int(i) for i in input().split()] d={} ans=0 for i in a: if i in d: d[i]+=1 else: d[i]=1 a=list(set(a)) a.sort() if len(a)<3: print(ans) else: for i in range(1,len(a)-1): ans+=d[a[i]] print(ans)
Noteの通りのことを何となく処理。今回書いたのよりも1年前に書いてたのがもう少しマシな書き方っぽいので辛かった。
B. Code For 1
ざっくりと大意
・7はx/2,x mod 2,x/2で、3,1,3になって1,1,1,1,3になって、1,1,1,1,1,1,1になって,2-5番目の数の和が4
・10は5,0,5で2,1,2,0,2,1,2になって、1,0,1,1,1,0,1,0,1,0,1,1,1,0,1になって、3-10番目の和が5
・後で
C. Jon Snow and his Favourite Number
ざっくりと大意
・読む気にならない