結果

問題 No.253 ロウソクの長さ
ユーザー 唐澤貴洋唐澤貴洋
提出日時 2015-10-17 20:15:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 2,642 ms
コンパイル使用メモリ 70,020 KB
実行使用メモリ 24,264 KB
平均クエリ数 33.97
最終ジャッジ日時 2023-09-23 21:54:29
合計ジャッジ時間 4,486 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,916 KB
testcase_01 AC 25 ms
23,712 KB
testcase_02 AC 27 ms
23,484 KB
testcase_03 AC 27 ms
24,264 KB
testcase_04 AC 25 ms
23,340 KB
testcase_05 AC 28 ms
23,616 KB
testcase_06 AC 26 ms
24,252 KB
testcase_07 AC 26 ms
24,144 KB
testcase_08 AC 27 ms
23,616 KB
testcase_09 AC 25 ms
23,364 KB
testcase_10 AC 27 ms
23,496 KB
testcase_11 AC 25 ms
23,616 KB
testcase_12 AC 26 ms
23,616 KB
testcase_13 AC 25 ms
24,216 KB
testcase_14 AC 26 ms
24,252 KB
testcase_15 AC 28 ms
23,604 KB
testcase_16 AC 26 ms
23,988 KB
testcase_17 AC 24 ms
24,156 KB
testcase_18 AC 26 ms
24,000 KB
testcase_19 AC 25 ms
23,976 KB
testcase_20 AC 26 ms
23,580 KB
testcase_21 AC 26 ms
23,472 KB
testcase_22 AC 25 ms
23,784 KB
testcase_23 AC 26 ms
23,472 KB
testcase_24 AC 27 ms
23,736 KB
testcase_25 AC 27 ms
23,328 KB
testcase_26 AC 25 ms
23,604 KB
testcase_27 AC 25 ms
24,000 KB
testcase_28 AC 24 ms
24,120 KB
testcase_29 AC 26 ms
23,592 KB
testcase_30 AC 25 ms
23,928 KB
testcase_31 AC 24 ms
23,364 KB
testcase_32 AC 25 ms
23,784 KB
testcase_33 AC 26 ms
23,484 KB
testcase_34 AC 26 ms
23,616 KB
testcase_35 AC 26 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<bitset>
#include<array>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<numeric>
#define D int
#define U unsigned
using namespace std;
D n, m, a, b, d, e;
char c;
bool g, h;
string s;
D threex[3] = { 0,1,1 };
D threey[3] = { 1,1,0 };
D ans;
D p[102][102],q[102][102];
int main() {
	D i, j, k;
	D t, u;
	cout << "? 100" << endl;
	cin >> t;
	if (t == 0) {
		cout << "! 100" << endl;
	}
	else if (t==-1) {
		for (i = 1; i < 100; i++) {
			cout << "? 0" << endl;
			cin >> t;
			if (t == 0)
				break;
		}
		cout << "! " << i << endl;
	}
	else {
		u = 0;
		for (i = 29; i >= 0; i--) {
			u += 1 << i;
			cout << "? " << u - (30 - i) << endl;
			cin >> t;
			if (t == 0) {
				cout << "! " << u << endl;
				break;
			}
			else if (t == -1) {
				u -= 1 << i;
			}
		}
	}
}
0