結果
問題 |
No.1700 floor X
|
ユーザー |
![]() |
提出日時 | 2025-07-11 13:59:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 3,262 ms |
コンパイル使用メモリ | 271,820 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-07-11 13:59:34 |
合計ジャッジ時間 | 5,219 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 44 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define el '\n' ll t, n; void solve() { cin >> n; ll l = 1, r = n; while (r - l > 5) { ll m = (l + r) / 2; if (m > n / m) { // Avoid overflow: equivalent to m*m > n r = m - 1; } else { l = m; } } ll res = l; for (ll i = l + 1; i <= r; i++) { if (i <= n / i) { // Avoid overflow: equivalent to i*i <= n res = i; } else { break; } } cout << res << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while (t--) { solve(); } }