2010-01-15から1日間の記事一覧

SRM458 Div1 Easy(250), Div2 Medium(500) BouncingBalls

BouncingBallsボールを区別しなければ反射も透過も同じ動き、とTwitterに書いてあった。初期位置とT秒後の位置で左右が入れ替わっていれば、2つのボールは衝突している。 #include <vector> using namespace std; class BouncingBalls { public: double expectedBou</vector>…

SRM458 Div2 Easy(250) Desertification

Desertification #include <string> #include <vector> using namespace std; class Desertification { public: int desertArea( vector <string> island, int T ); }; int Desertification::desertArea( vector <string> island, int T ) { int h = (int)island.size(); int w = (int)island</string></string></vector></string>…

SRM458

忙しかったので不参加。

SRM458 Div1 Medium(450) NewCoins

NewCoinsDP。値段rの製品を1とp以上の価値のコインc枚で払えるならば、dをpの約数として、価値dのコインを加えればc-r%p/d*d+d枚のコインで払える。pで払いきれなかった余りr%pのうちr%p/d*dをd枚のコインで払えるので。 実行時間がちょっと怖い。私のプログ…