結果

問題 No.305 鍵(2)
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-02-23 20:33:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 24,048 KB
平均クエリ数 86.69
最終ジャッジ日時 2023-09-23 15:49:15
合計ジャッジ時間 2,041 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
23,340 KB
testcase_01 AC 26 ms
23,604 KB
testcase_02 AC 25 ms
23,928 KB
testcase_03 AC 25 ms
23,760 KB
testcase_04 AC 24 ms
23,844 KB
testcase_05 AC 23 ms
23,544 KB
testcase_06 AC 23 ms
23,544 KB
testcase_07 AC 26 ms
23,976 KB
testcase_08 AC 25 ms
23,556 KB
testcase_09 AC 24 ms
23,856 KB
testcase_10 AC 25 ms
23,424 KB
testcase_11 AC 25 ms
23,844 KB
testcase_12 AC 25 ms
24,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:37:22: 警告: ‘a’ may be used uninitialized [-Wmaybe-uninitialized]
   37 |         ans[i] = '0' + a;
      |                  ~~~~^~~
main.cpp:23:13: 備考: ‘a’ はここで定義されています
   23 |         int a;
      |             ^

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    string ans = "0000000000";
    for ( int i = 0; i < 10; i++) {
        int xm = -1;
        int a;
        for ( int j = 0; j < 10; j++) {
            ans[i] = '0' + j;
            cout << ans << endl;
            int x;
            cin >> x;
            string s;
            cin >> s;
            if ( s == "unlocked" ) { return 0; }
            if ( xm < x ) {
                xm = x;
                a = j;
            }
        }
        ans[i] = '0' + a;
    }
    return 0;
}
0