結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-05-05 17:16:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 505 bytes |
| コンパイル時間 | 587 ms |
| コンパイル使用メモリ | 68,040 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 53.46 |
| 最終ジャッジ日時 | 2024-07-16 23:40:22 |
| 合計ジャッジ時間 | 1,953 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:15:30: warning: 'keep' may be used uninitialized [-Wmaybe-uninitialized]
15 | else if(x > keep){
| ^~
main.cpp:7:33: note: 'keep' was declared here
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;
}
ldsyb