結果

問題 No.1700 floor X
ユーザー vjudge1
提出日時 2025-07-11 14:00:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 686 bytes
コンパイル時間 3,013 ms
コンパイル使用メモリ 275,388 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-11 14:00:30
合計ジャッジ時間 5,081 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#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)     
        {
            r = m - 1;
        }
        else
        {
            l = m;
        }
    }
    ll res = l;
    for (ll i = l + 1; i <= r; i++)
    {
        if (i <= n / i)     
        {
            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();
    }
}
0