結果
問題 | No.253 ロウソクの長さ |
ユーザー | machy |
提出日時 | 2015-07-25 00:09:38 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 365 ms |
コンパイル使用メモリ | 51,696 KB |
実行使用メモリ | 24,504 KB |
平均クエリ数 | 30.75 |
最終ジャッジ日時 | 2023-09-23 05:03:06 |
合計ジャッジ時間 | 5,962 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 26 ms
23,664 KB |
testcase_02 | AC | 27 ms
24,348 KB |
testcase_03 | AC | 26 ms
23,472 KB |
testcase_04 | AC | 25 ms
24,396 KB |
testcase_05 | AC | 27 ms
24,228 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 26 ms
23,652 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 25 ms
23,676 KB |
testcase_15 | AC | 27 ms
23,448 KB |
testcase_16 | AC | 26 ms
24,336 KB |
testcase_17 | AC | 26 ms
23,352 KB |
testcase_18 | WA | - |
testcase_19 | AC | 25 ms
24,372 KB |
testcase_20 | WA | - |
testcase_21 | AC | 26 ms
23,640 KB |
testcase_22 | AC | 27 ms
23,964 KB |
testcase_23 | WA | - |
testcase_24 | AC | 27 ms
23,700 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 25 ms
24,288 KB |
testcase_35 | WA | - |
ソースコード
#include <iostream> using namespace std; int main(){ int left = 0; int right = 1000000001; int cnt = 0; int ans; cout << "? 100" << endl; cout.flush(); cin >> ans; if(ans == -1){ for(int i = 0; i < 99; i++){ cout << "? 9" << endl; cout.flush(); cin >> ans; if(ans == 0){ cout << "! " << 10 + i << endl; break; } } return 0; }else if(ans == 0){ cout << "! 100" << endl; return 0; } while(left + 1 < right){ int middle = (left + right) / 2; cout << "? " << max(0, middle - cnt) << endl; cout.flush(); int ans; cin >> ans; if(ans == -1){ right = middle; }else if(ans == 0){ left = middle; break; }else{ left = middle; } cnt++; } cout << "! " << left << endl; return 0; }