#include<bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
string name;
cin >> name;
int n, t;
cin >> n >> t;
while(t--){
string s;
cin >> s;
string ans;
for(int i = 0; i < n; i++){
if(s[i] == '0'){
cout << 'P' << '\n';
}else{
cout << 'K' << '\n';
}
cout.flush();
char c;
cin >> c;
if(c == 'P'){
ans.push_back('0');
}else{
ans.push_back('1');
}
cout << c << "\n";
cout.flush();
cin >> c;
}
cout << "! " << ans << '\n';
cout.flush();
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<bits/stdc++.h> using ll = long long; using namespace std; int main(){ string name; cin >> name; int n, t; cin >> n >> t; while(t--){ string s; cin >> s; string ans; for(int i = 0; i < n; i++){ if(s[i] == '0'){ cout << 'P' << '\n'; }else{ cout << 'K' << '\n'; } cout.flush(); char c; cin >> c; if(c == 'P'){ ans.push_back('0'); }else{ ans.push_back('1'); } cout << c << "\n"; cout.flush(); cin >> c; } cout << "! " << ans << '\n'; cout.flush(); } } |
English