제출 #331232

#제출 시각아이디문제언어결과실행 시간메모리
331232PetiPassword (RMI18_password)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; string guess(int n, int s){ vector<int> db(26, 0); for(int i = 0; i < s; i++){ char c = (char)((int)'a' + i); string q; q.assign(n, c); db[i] = query(q); } string pass; pass.assign(db[0], 'a'); for(int i = 1; i < s; i++){ char c = (char)((int)('a' + i)); for(int j = 0; j < db[i]; j++){ int x = 0; while(1){ string q = pass; q.insert(q.begin() + x, c); if(query(q) == (int)q.size()){ pass = q; break; } x++; } } } return pass; }

컴파일 시 표준 에러 (stderr) 메시지

password.cpp: In function 'std::string guess(int, int)':
password.cpp:12:17: error: 'query' was not declared in this scope
   12 |         db[i] = query(q);
      |                 ^~~~~
password.cpp:24:20: error: 'query' was not declared in this scope
   24 |                 if(query(q) == (int)q.size()){
      |                    ^~~~~