結果
問題 |
No.3037 トグルトグルトグル!
|
ユーザー |
|
提出日時 | 2025-03-21 15:29:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 4,089 ms |
コンパイル使用メモリ | 272,328 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 15:29:56 |
合計ジャッジ時間 | 4,323 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll floor_sqrt(ll N){ assert(N >= 0); ll ok = 0; ll ng = N + 1; while(abs(ok - ng) > 1){ ll mid = (ok + ng) / 2; (mid <= N / mid ? ok : ng) = mid; } return ok; } ll isqrt(ll n){ ll x = n; ll y = (x + 1) / 2; while(y < x){ x = y; y = (x + n / x) / 2; } return x; } int main(){ ll N;cin >> N; cout << floor_sqrt(N) << '\n'; }