AtCoder Beginner Contest 104
はい。
https://beta.atcoder.jp/contests/abc104
A - Rated for Me
Python3
r=int(input()) print("AGC" if r>=2800 else "ARC" if r>=1200 else "ABC")
2800,1200で分岐で。
B - AcCepted
Python3
s=input() t=len(s) A=ord("A") Z=ord("Z") f=0 for a,i in enumerate(s): if a==0: if i!="A": print("WA") exit() elif a==1: if A<=ord(i)<=Z: print("WA") exit() elif a<t-1: if (i=="C" and f==1) or (A<=ord(i)<=Z and i!="C"): print("WA") exit() elif i=="C" and f==0: f=1 else: if A<=ord(i)<=Z: print("WA") exit() print("AC" if f==1 else "WA")
問題文で示されている条件で分岐を。
C - All Green
Python3
d,g=map(int,input().split()) g//=100 l={} t=[] cnt=ans=0 for i in range(d): p,c=map(int,input().split()) c//=100 l[i+1]=[p,c] t.append((i+1)*p+c) ans+=p for i in range(1<<d): x=[0,0,0] for j in range(d): if (i&(1<<j)): x[0]+=l[j+1][0] x[1]+=t[j] else: x[2]=j if x[1]>=g: ans=min(ans,x[0]) elif ((g-x[1])+x[2])//(x[2]+1)<=l[x[2]+1][0]: ans=min(ans,x[0]+((g-x[1])+x[2])//(x[2]+1)) print(ans)
それぞれの配点を全回答してコンプリートボーナス付きの点数を調べておく。ビットで全探索でそれぞれの配点を使うもの使わないものとか列挙して点数を合計する。問題数もカウントする。まだ目標点に足りていない場合は使わないものの配点のウチで最も大きい物を1からコンプリート-1個まで使って点数が足りるか確認、足りるなら割り算で最小必要数だけ問題数を加算。他のパターンとの問題数を比較してminだけ保存して繰り返し。