結果
問題 | No.253 ロウソクの長さ |
ユーザー | lunnear |
提出日時 | 2019-01-28 05:19:12 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 835 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 51,812 KB |
実行使用メモリ | 24,432 KB |
平均クエリ数 | 44.08 |
最終ジャッジ日時 | 2023-09-23 16:46:13 |
合計ジャッジ時間 | 5,120 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
24,180 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 23 ms
23,400 KB |
testcase_06 | AC | 23 ms
23,436 KB |
testcase_07 | AC | 25 ms
23,940 KB |
testcase_08 | AC | 25 ms
23,844 KB |
testcase_09 | AC | 24 ms
23,316 KB |
testcase_10 | AC | 25 ms
24,324 KB |
testcase_11 | AC | 24 ms
23,436 KB |
testcase_12 | WA | - |
testcase_13 | AC | 25 ms
23,544 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 24 ms
23,448 KB |
testcase_17 | AC | 23 ms
23,940 KB |
testcase_18 | AC | 24 ms
23,952 KB |
testcase_19 | AC | 25 ms
23,664 KB |
testcase_20 | WA | - |
testcase_21 | AC | 23 ms
23,448 KB |
testcase_22 | AC | 24 ms
23,580 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 24 ms
23,556 KB |
testcase_26 | AC | 24 ms
23,640 KB |
testcase_27 | WA | - |
testcase_28 | AC | 25 ms
24,024 KB |
testcase_29 | AC | 23 ms
23,460 KB |
testcase_30 | AC | 24 ms
23,640 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 24 ms
23,400 KB |
testcase_34 | AC | 23 ms
24,168 KB |
testcase_35 | WA | - |
ソースコード
#include <iostream> int q(int x) { int ret; std::cout << "? " << x << std::endl; std::cout << std::flush; std::cin >> ret; return ret; } int main() { int a; a = q(100); if(a == 0) { std::cout << "! 100" << std::endl; return 0; } int min, max, cur, i; min = 1; max = (a > 0)? 1000000000:100; cur = (max - min) / 2; i = 1; for(; i < 100; i++) { a = q(cur); if(a == 0) break; if(a > 0) { min = cur + 1; cur += ((max - min) / 2); } else { max = cur - 1; cur -= ((max - min) / 2) - 1; } max--; min--; } std::cout << "! " << cur + i << std::endl; return 0; }