int main() { BinaryCode* bin = new BinaryCode(); string p = "22111"; auto ret = bin->decode(p); cout << ret[0] <<": " << ret[1]<< endl; delete bin; return 0; }
bool KawigiEdit_RunTest(int testNum, string p0, bool hasAnswer, vector <string> p1) { cout << "Test " << testNum << ": [" << "\"" << p0 << "\""; cout << "]" << endl; BinaryCode *obj; vector <string> answer; obj = new BinaryCode(); clock_t startTime = clock(); answer = obj->decode(p0); clock_t endTime = clock(); delete obj; bool res; res = true; cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl; if (hasAnswer) { cout << "Desired answer:" << endl; cout << "\t" << "{"; for (int i = 0; int(p1.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << "\"" << p1[i] << "\""; } cout << "}" << endl; } cout << "Your answer:" << endl; cout << "\t" << "{"; for (int i = 0; int(answer.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << "\"" << answer[i] << "\""; } cout << "}" << endl; if (hasAnswer) { if (answer.size() != p1.size()) { res = false; } else { for (int i = 0; int(answer.size()) > i; ++i) { if (answer[i] != p1[i]) { res = false; } } } } if (!res) { cout << "DOESN'T MATCH!!!!" << endl; } else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) { cout << "FAIL the timeout" << endl; res = false; } else if (hasAnswer) { cout << "Match :-)" << endl; } else { cout << "OK, but is it right?" << endl; } cout << "" << endl; return res; }
int SRM_144_Div2_550() { BinaryCode binary; vector<string> result = binary.decode("1"); cout << result[0] << endl; cout << result[1] << endl; int test; cin >> test; return 0; }
int SRM_144_Div1_300() { BinaryCode code; vector<string> results = code.decode("123210122"); cout << results[0] << endl; cout << results[1] << endl; int test = 0; cin >> test; return 0; }
bool do_test(string message, vector<string> __expected) { time_t startClock = clock(); BinaryCode *instance = new BinaryCode(); vector<string> __result = instance->decode(message); double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC; delete instance; if (__result == __expected) { cout << "PASSED!" << " (" << elapsed << " seconds)" << endl; return true; } else { cout << "FAILED!" << " (" << elapsed << " seconds)" << endl; cout << " Expected: " << to_string(__expected) << endl; cout << " Received: " << to_string(__result) << endl; return false; } }
int main(){ BinaryCode B; vector<string> V = B.decode("123210122"); cout << V[0]<< endl<< V[1]<< endl; V = B.decode("11"); cout << V[0]<< endl<< V[1]<< endl; V = B.decode("22111"); cout << V[0]<< endl<< V[1]<< endl; V = B.decode("123210120"); cout << V[0]<< endl<< V[1]<< endl; V = B.decode("3"); cout << V[0]<< endl<< V[1]<< endl; V = B.decode("12221112222221112221111111112221111"); cout << V[0]<< endl<< V[1]<< endl; return 0; }