2010-11-19から1日間の記事一覧

SRM488 Div2 Hard(1000) TheBoringGameDivTwo

試合の進み方が9通りあって、それぞれの回数をx1〜x9とすると、 x1(0,0,0,+1,0,+1)+x2(0,+1,0,0,0,+1)+x3(-1,+1,0,+1,+1,0)+x4(0,+1,-1,+1,+1,0)+x5(+1,0,0,0,0,+1)+x6(0,0,+1,0,0,+1)+x7(0,+1,+1,0,+1,+1)+x8(+1,0,0,+1,+1,+1)+x9(0,+1,0,+1,+2,0)=(scoreJ…

SRM488 Div2 Medium(500) TheBoringStoreDivTwo

TheBoringStoreDivTwo文字列長が短いのでO(n8)でも間に合う。 #include <string> using namespace std; class TheBoringStoreDivTwo{public: string find( string J, string B ) { int x = (int)J.length(); int y = (int)B.length(); string ans = ""; for ( int i=</string>…

SRM488 Div2 Easy(250) TheBoredomDivTwo

TheBoredomDivTwo class TheBoredomDivTwo{public: int find( int n, int m, int j, int b ) { return n + (j>n) + (b>n); }};

SRM488 Div1 Easy(250) TheBoredomDivOne

TheBoredomDivOne動的計画法。退屈ではない人がi人の場合に全員を退屈にする時間の期待値をbi、その時に退屈ではない人をj人選ぶ確率をpjとすると、bi = p0 bi + p1 bi-1 + p2 bi-2 + 1。変形して、bi = ( p1 bi-1 + p2 bi-2 + 1 ) / (1-p0)。 #include <vector> usi</vector>…

SRM488

Easy (250) 145.35 Medium (500) 0 Hard (1000) 0 Challenge 0 結果 1797 → 1831145点で145位だった。