2009-11-26から1日間の記事一覧
TheProduct動的計画法。最後が numbers[i] である k 個の数字の積が取りうるのは、最後が numbers[i-maxDist]〜numbers[i-1] である k-1 個の数字の積に numbers[i] を乗じた値。各マスでは正負それぞれ絶対値が最小・最大であるものだけ記憶しておけばよい…
Div 1の250と同じ。
クラス定義とか入力例をコピペするのが面倒になってきたので、プラグインを導入した。定番らしいCodeProcessor+TZTester+FileEdit。テンプレートはこんな感じ。 #include <iostream> #include <string> #include <vector> using namespace std; class $CLASSNAME$ { public: $RC$ $METH</vector></string></iostream>…
ToolsBox #include <sstream> #include <vector> #include <set> using namespace std; class ToolsBox { public: int countTools( vector<string> need ) { set<string> tool; for ( int i=0; i<(int)need.size(); i++ ) { stringstream s( need[i] ); string t; while ( s >> t ) tool.insert( t </string></string></set></vector></sstream>…