Codeforces Round #313 (Div.2)
はい。
http://codeforces.com/contest/560
A. Currency System in Geraldion
ざっくりと大意
・n種類ある\(a_i\)の通貨の組み合わせで作れない金額の最小のものを出力。それがない場合は-1を出力。
方針のようなもの
・試す。
#テスト3でWA n=int(raw_input()) l=map(int,raw_input().split()) ans=chk=0 ans=set([0]) for i in l: ans |= set(j+i for j in ans) chk=sum(l)+1 ans=list(ans) ans.sort() for i in range(chk): try: if i!=ans[i]: print i exit() except IndexError: print i exit() print -1
これだと各通貨を1度しか使わずに組み合わせを見ているので方針が違うので後で。