2012-11-01から1ヶ月間の記事一覧
TypingDistance #include <string> #include <cstdlib> using namespace std; class TypingDistance{public: int minDistance( string keyboard, string word ) { int ans = 0; int p = 0; for ( int i=0; i<(int)word.size(); i++ ) { int t = 0; while ( keyboard[t]!=word[</cstdlib></string>…
DrawingPointsDivOne問題文では古い点が幅1の正方形になっていると中央に新しい点を描くと言っているけど、中央ではなく左下の点と考えると、扱いが楽になる。WojtekがSステップ処理を行うことができるかどうかは、Sステップ戻してからSステップ進めて、余計…
TomekPhone出現数の多い文字から順に、キーストロークの少ない位置に割り振っていく。 #include <algorithm> #include <vector> #include <functional> using namespace std; class TomekPhone{public: int minKeystrokes( vector <int> occurences, vector <int> keySizes ) { sort(occurences.begin(</int></int></functional></vector></algorithm>…
Easy (250) 233.55 Medium (500) 0 Hard (1000) 0 Challenge 0 結果 190位 2107→2093