結果
問題 | No.305 鍵(2) |
ユーザー |
|
提出日時 | 2016-02-08 20:29:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 1,099 bytes |
コンパイル時間 | 1,315 ms |
コンパイル使用メモリ | 160,724 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 92.62 |
最終ジャッジ日時 | 2024-07-16 22:53:51 |
合計ジャッジ時間 | 2,297 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(i=0;i<n;++i) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++) #define mp make_pair #define pb push_back #define fi first #define sc second int main(int argc, char const *argv[]) { int i,j; bool found=false; while(1){ int x; string lock; string ans="0000000000"; rep(i,10){//左からi番目の桁について int ct[10]={0}; rep(j,10){ string r="0000000000"; r[i]=j+'0'; cout << r <<endl; cout <<flush; cin >>x >>lock; if(x==10){ found=true; break; } else{ ct[j]=x; } } if(found)break; else{ int m=0; int r=-1; rep(j,10){ if(m<ct[j]){ m=ct[j]; r=j; } } ans[i]='0'+r; } } if(found)break; cout << ans <<endl; cout <<flush; cin >>x >>lock; if(x==10){ found=true; break; } } return 0; }