結果
問題 | No.305 鍵(2) |
ユーザー | ldsyb |
提出日時 | 2016-05-05 17:16:53 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 563 ms |
コンパイル使用メモリ | 67,188 KB |
実行使用メモリ | 24,240 KB |
平均クエリ数 | 53.46 |
最終ジャッジ日時 | 2023-09-23 23:50:11 |
合計ジャッジ時間 | 2,006 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
24,228 KB |
testcase_01 | AC | 25 ms
23,472 KB |
testcase_02 | AC | 24 ms
24,036 KB |
testcase_03 | AC | 26 ms
24,240 KB |
testcase_04 | AC | 27 ms
23,616 KB |
testcase_05 | AC | 28 ms
23,628 KB |
testcase_06 | AC | 25 ms
23,688 KB |
testcase_07 | AC | 27 ms
23,868 KB |
testcase_08 | AC | 27 ms
24,060 KB |
testcase_09 | AC | 26 ms
23,436 KB |
testcase_10 | AC | 27 ms
24,000 KB |
testcase_11 | AC | 26 ms
23,592 KB |
testcase_12 | AC | 27 ms
23,592 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:15:30: 警告: ‘keep’ may be used uninitialized [-Wmaybe-uninitialized] 15 | else if(x > keep){ | ^~ main.cpp:7:33: 備考: ‘keep’ はここで定義されています 7 | for(int i = 0,x,keep;i < 10;i++){ | ^~~~
ソースコード
#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 += to_string(i); break; }else if(x < keep){ ans += to_string(i - 1); break; } } } cout << ans << endl; }