2010-02-13から1日間の記事一覧
TrappingRabbit意訳:トラップまでのマンハッタン距離の最小値を求めよ。 #include <vector> using namespace std; class TrappingRabbit { public: int findMinimumTime( vector <int> trapX, vector <int> trapY ); }; int TrappingRabbit::findMinimumTime( vector <int> trapX, </int></int></int></vector>…
ColoringRectangle大きい順で赤青交互に並べていく。赤から始める場合と青から始める場合の両方試す。 #include <vector> #include <algorithm> #include <cmath> using namespace std; class ColoringRectangle { int choose( int width, int height, vector<int> d1, vector<int> d2 ); public:</int></int></cmath></algorithm></vector>…
Easy (300) 161.04いまいち正当性に自信が無かったけど、あっていたようだ。Medium (500) 0街と増設した街の数をペアにしたダイクストラ法かなと思いつつも実装しきれず。Hard (1000) 0見てない。結果 1448 → 1520黄色になれた。