結果

問題 No.305 鍵(2)
ユーザー ldsybldsyb
提出日時 2016-05-05 17:12:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 66,000 KB
実行使用メモリ 24,576 KB
平均クエリ数 53.46
最終ジャッジ日時 2023-09-23 10:34:14
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,432 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 25 ms
23,604 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:18:31: 警告: ‘keep’ may be used uninitialized [-Wmaybe-uninitialized]
   18 |                         }else if(x < keep){
      |                               ^~
main.cpp:7:33: 備考: ‘keep’ はここで定義されています
    7 |                 for(int i = 0,x,keep;i < 10;i++){
      |                                 ^~~~

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
	string ans = "",gomi;
	for(int digit = 0;digit < 10;digit++){
		for(int i = 0,x,keep;i < 10;i++){
			for(int j = 0;j < digit;j++) cout << '0';
			cout << i;
			for(int j = digit + 1;j < 10;j++) cout << '0';
			cout << endl;
			cin >> x >> gomi;
			if(x == 10) return 0;
			if(i == 0) keep = x;
			else if(x > keep){
				ans += i;
				break;
			}else if(x < keep){
				ans += i - 1;
				break;
			}
		}
	}
	cout << ans << endl;
}
0