版本比较
U610352 安全楼层 题解
正文
增加 43 行删除 0 行
73 行未改动747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912073 行未改动x = \left\lceil\cfrac{-1+\sqrt{1+8n}}{2}\right\rceil\approx\sqrt{2n}$$
最坏 $x = 14$ 步。
std by @2huk。
```c++ line-numbers#include <bits/stdc++.h>
using namespace std;
signed main() { int x = 14, lst = 1; while (lst < 99) { int nxt = min(99, lst + x); cout << "? " << nxt << endl; int c; cin >> c; if (c) { for (int i = lst + 1; i < nxt; ++ i ) { cout << "? " << i << endl; int c; cin >> c; if (c) { cout << "! " << i - 1 << endl; return 0; } } cout << "! " << nxt - 1 << '\n'; return 0; } lst = nxt; x -- ; } cout << "! " << 99; return 0;}```
### 闲话
Gyf 改了好几遍 `checker.cpp`。
Gyf 押中了 CSP2025-S1 的阅读程序 T2。
作弊码:`xzsb`。