2009-07-01から1日間の記事一覧

SRM 419 DV2 500

C++

簡単なテキストエディタを想定して、それにundoを実装する問題。 #include <vector> #include <string> using namespace std; class Undo{ private: bool isType(string command){ string::size_type index = command.find("type"); if (index == string::npos){ return fals</string></vector>…

SRM 419 DIV2 250

C++

与えられた配列から周囲長を算出する問題。 簡単。 #include <vector> #include <cmath> using namespace std; class ColumnDiagramPerimeter{ public: int getPerimiter(vector <int> a){ int ans = 0; int size = a.size(); ans += size * 2; ans += a[0]; for (int i = 1; i <</int></cmath></vector>…