結果
問題 | No.3037 トグルトグルトグル! |
ユーザー |
|
提出日時 | 2025-03-21 15:30:20 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 3,049 ms |
コンパイル使用メモリ | 273,568 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 15:30:25 |
合計ジャッジ時間 | 3,955 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 << isqrt(N) << '\n';}