結果

問題 No.305 鍵(2)
ユーザー なおなお
提出日時 2016-05-04 20:23:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 147,228 KB
実行使用メモリ 24,048 KB
平均クエリ数 26.77
最終ジャッジ日時 2023-09-23 23:49:58
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,616 KB
testcase_01 AC 25 ms
24,012 KB
testcase_02 AC 26 ms
24,012 KB
testcase_03 AC 26 ms
24,036 KB
testcase_04 AC 26 ms
23,664 KB
testcase_05 AC 26 ms
23,448 KB
testcase_06 AC 26 ms
23,364 KB
testcase_07 AC 26 ms
23,400 KB
testcase_08 AC 27 ms
24,048 KB
testcase_09 AC 27 ms
23,376 KB
testcase_10 AC 26 ms
23,988 KB
testcase_11 AC 27 ms
23,364 KB
testcase_12 AC 27 ms
24,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))
#define in(T,V) T V;cin>>V;
const int MOD = int(1e9+7);

int check(int n[10]){
    string s;
    REP(i,10){
        s += char('0' + n[i]);
    }
    cout << s << endl;
    getline(cin, s);
    stringstream ss(s);
    int v; ss >> v;
    return v;
}

int main(){
    int n[10],b[10];
    REP(i,10){
        REP(j,10) n[j] = i;
        b[i] = check(n);
        if(b[i] == 10) return 0;
    }

    int r = b[9];
    REP(i,10){
        REP(j,10){
            if(b[j] == 0) continue;
            n[i] = j;
            int v = check(n);
            if(v == 10) return 0;
            if(r < v){
                r = v; b[j]--;
                break;
            }
        }
    }
}
0