Codeforces Round #242 (Div. 2)
はい。
http://codeforces.com/contest/424
A. Squats
ざっくりと大意
・多分立ってるハムスター'X'と座っているハムスター'x'を同じ数にするのに最小変更がいくつか???
方針のようなもの
・多い方だけ変更する。最初から等しければ何もしない。
n=int(raw_input()) w=list(raw_input()) chk=n/2 b=s=0 for i in w: if i=='X': b+=1 else: s+=1 ans=abs(max(b,s)-chk) while s-b: for i in range(n): if w[i]=='X' and b>s: w[i]='x' b-=1 s+=1 elif w[i]=='x' and b<s: w[i]='X' b+=1 s-=1 if b==s: break print ans print ''.join(w)