結果
問題 | No.253 ロウソクの長さ |
ユーザー | Kmcode1 |
提出日時 | 2015-07-25 02:47:37 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 831 ms |
コンパイル使用メモリ | 93,252 KB |
実行使用メモリ | 24,300 KB |
平均クエリ数 | 51.56 |
最終ジャッジ日時 | 2023-09-23 05:12:37 |
合計ジャッジ時間 | 7,122 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 27 ms
23,304 KB |
testcase_02 | WA | - |
testcase_03 | AC | 27 ms
23,424 KB |
testcase_04 | AC | 27 ms
23,820 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 28 ms
23,544 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 27 ms
23,256 KB |
testcase_15 | WA | - |
testcase_16 | AC | 28 ms
23,328 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 26 ms
23,556 KB |
testcase_20 | WA | - |
testcase_21 | AC | 28 ms
23,448 KB |
testcase_22 | AC | 27 ms
23,568 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
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 | 26 ms
24,108 KB |
testcase_35 | WA | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:25: warning: ‘k’ may be used uninitialized in this function [-Wmaybe-uninitialized] int k = ask - (k*i + 1); ~^~
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cctype> #include<cstdlib> #include<algorithm> #include<bitset> #include<vector> #include<list> #include<deque> #include<queue> #include<map> #include<set> #include<stack> #include<cmath> #include<sstream> #include<fstream> #include<iomanip> #include<ctime> #include<complex> #include<functional> #include<climits> #include<cassert> #include<iterator> #include<unordered_map> #include<stdint.h> using namespace std; int main(void) { int i, ask = (1 << 30), ans0, ans1 = -1, y=0; for (i = 0; i < 30; i++) { printf("? %d\n", 1); fflush(stdout); scanf("%d", &ans0); if (ans0 != 1) { y = 2 * i + (ans0 == 0); break; } ask += ans1 * (1 << (29 - i)); int k = ask - (k*i + 1); if(k<0){ k = 0; } printf("? %d\n",k); fflush(stdout); scanf("%d", &ans1); if (ans1 == 0) { y = ask; break; } } printf("! %d\n", y); fflush(stdout); return 0; }