結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2015-11-27 23:53:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 1,516 bytes |
| コンパイル時間 | 604 ms |
| コンパイル使用メモリ | 83,840 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 65.69 |
| 最終ジャッジ日時 | 2024-07-16 21:52:01 |
| 合計ジャッジ時間 | 1,824 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;
const int N=10;
int main(){
srand(time(NULL));
bool f[N]={};
char d[N]={};
while(true){
// for(int i=0;i<N;i++) printf("(%d,%c) ",f[i],d[i]);
// cout<<endl;
//cout<<"new"<<endl;
string out;
for(int i=0;i<N;i++){
if(f[i]) out+=d[i];
else out+=(char)('0'+rand()%10);
}
cout<<out<<endl;
cout.flush();
int x;
string res;
cin>>x>>res;
if(res[0]=='u') return 0;
string test=out;
for(int i=0;i<N;i++){
//if(f[i]){cout<<"digit"<<i<<" is ok "<<endl; continue;}
if(f[i]) continue;
string test=out;
test[i]='0'+rand()%10;
cout<<test<<endl;
cout.flush();
int y;
string test_res;
cin>>y>>test_res;
//cout<<"x="<<x<<" y="<<y<<endl;
if(test_res[0]=='u') return 0;
if(x>y){
f[i]=true; d[i]=out[i];
}else if(x<y){
f[i]=true; d[i]=test[i];
}
}
//cout<<endl;
}
return 0;
}
Lay_ec