2011-08-21から1日間の記事一覧

SRM515 Div2 Easy(250) FortunateNumbers

FortunateNumbers #include <vector> #include <set> using namespace std; class FortunateNumbers{public: int getFortunate( vector <int> a, vector <int> b, vector <int> c ) { set<int> F; for ( int i=0; i<(int)a.size(); i++ ) for ( int j=0; j<(int)b.size(); j++ ) for ( int k=0</int></int></int></int></set></vector>…

SRM515 Div1 Medium(550) NewItemShop

NewItemShop動的計画法。時刻、残りの剣数、それぞれの客が来たかどうかごとに最大期待値を覚えておく。客数は最大で24人だけど、1度しか来ない客が来たかどうかの情報は必要ない。1度に1人しか客が来ないという制約から、2回以上来る客は高々12人。 #includ…

SRM515 Div2 Hard(1000) NewItemShopTwo

NewItemShopTwo動的計画法。時刻ごと、それぞれの客が来たかどうかごとに最大期待値を覚えておく。 #include <string> #include <vector> #include <sstream> using namespace std; class NewItemShopTwo{public: double getMaximum( vector <string> customers ) { double C[24][2] = {{0}}; </string></sstream></vector></string>…