結果
| 問題 | No.253 ロウソクの長さ | 
| コンテスト | |
| ユーザー |  唐澤貴洋 | 
| 提出日時 | 2015-10-17 20:15:22 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 25 ms / 2,000 ms | 
| コード長 | 921 bytes | 
| コンパイル時間 | 762 ms | 
| コンパイル使用メモリ | 70,320 KB | 
| 実行使用メモリ | 25,220 KB | 
| 平均クエリ数 | 33.97 | 
| 最終ジャッジ日時 | 2024-07-16 21:41:59 | 
| 合計ジャッジ時間 | 3,624 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 36 | 
ソースコード
#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;
			}
		}
	}
}
            
            
            
        