SRM269 DIV2 250
#include <vector> using namespace std; class AccessChanger { private: string rep(string s){ int hit; string dst; dst = s; while((hit = dst.find("->", 0)) != -1){ dst.replace(hit, 2, "."); } return dst; } public: vector<string> convert(vector<string> program){ vector<string> dst; for(int i = 0; i < program.size(); i++){ string code(""), cmt(""); int po = -1; if((po = program[i].find("//",0)) != -1){ code = program[i].substr(0, po); cmt = program[i].substr(po, program[i].size() - po); }else{ code = program[i]; } code = rep(code); dst.push_back(code+cmt); } return dst; } };
System> peryaudo has submitted the 250-point problem for 175.28 points
正気だったらこんな汚いコード書きません。
文字列処理系はその言語ないしはライブラリ慣れしてる人間じゃないとササッと書いたりできないし仕方ない面もある。精進します。