2011-02-28から1日間の記事一覧

SRM498 Div2 Hard(950) NinePuzzle

通常の正方形のパズルと異なり任意の配置が可能なので、並びを気にせずにinitをgoalに塗り替えるのに必要な回数を求めれば良い。 #include <string> #include <algorithm> using namespace std; class NinePuzzle{public: int getMinimumCost( string init, string goal ) { ret</algorithm></string>…

SRM498 Div2 Easy(250) AdditionGame

AdditionGame class AdditionGame{public: int getMaximumPoints( int A, int B, int C, int N ) { int ans = 0; for ( int i=0; i<N; i++ ) { if ( A>=B && A>=C && A>=1 ) ans+=A, A--; else if ( B>=C && B>=A && B>=1 ) ans+=B, B--; else if ( C>=A && C>=B && C>=1 ) ans+</n;>…