結果

問題 No.305 鍵(2)
ユーザー Bantako
提出日時 2017-08-23 13:16:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 4,367 ms
コンパイル使用メモリ 166,084 KB
実行使用メモリ 25,476 KB
平均クエリ数 44.08
最終ジャッジ日時 2024-07-17 01:25:54
合計ジャッジ時間 3,080 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    string key = "0000000000",ans;
    int max,n;
    cout << key << endl;
    fflush(0);
    cin >> max >> ans;
    if(ans == "unlocked")return 0;
    for(int i = 0;i < 10;i++){
        for(int j = 1;j < 10;j++){
            key[i] = j + '0';
            cout << key << endl;
            fflush(0);
            cin >> n >> ans;
            if(ans == "unlocked")return 0;
            if(n > max){
                max = n;
                break;
            }
            if(n < max){
                key[i] = '0';
                break;
            }
        }
    }
}   
0