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

SRM472 Div2 Easy(250) ColorfulTilesEasy

ColorfulTilesEasy #include <string> using namespace std; class ColorfulTilesEasy { public: int theMin( string room ); }; int ColorfulTilesEasy::theMin( string room ) { int c = 0; for ( int i=1; i<(int)room.length(); i++ ) if ( room[i] == room[i-1]</string>…

SRM472 Div2 Hard(1000) RectangularIsland

RectangularIsland問題サイズが小さければDPで簡単に求められるが、この問題だと時間が足りない。横方向と縦方向の移動を分けて考える。sステップ横方向に動いたあと島に居る確率をph(s)、縦方向をpv(s)とする。steps回の移動のうち、ちょうどi回横方向に動…