結果
問題 | No.2768 Password Crack |
ユーザー |
|
提出日時 | 2024-05-31 21:41:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 1,825 ms |
コンパイル使用メモリ | 195,468 KB |
最終ジャッジ日時 | 2025-02-21 17:39:35 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; string s(N,'a'); int S; cout << "? " << s << endl; cin >> S; string answer = ""; for(int i=0; i<N; i++){ bool add = false; for(char c='b'; c<='y'; c++){ s.at(i) = c; cout << "? " << s << endl; int now; cin >> now; if(S == now+1){ add = true; answer += 'a'; break; } if(now == S+1){ add = true; answer += c; break; } } if(add == false) answer += 'z'; s.at(i) = 'a'; } cout << "! " << answer << endl; }