結果

問題 No.1700 floor X
ユーザー V_Melville
提出日時 2021-10-08 22:48:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 2,121 ms
コンパイル使用メモリ 192,000 KB
最終ジャッジ日時 2025-01-24 23:02:01
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using ll = long long;

ll mySqrt(ll x) {
	ll l = 0, r = x, res = -1;
	while (l <= r) {
		ll mid = l + (r - l) / 2;
		if (mid * mid <= x) {
			res = mid;
			l = mid + 1;
		}
		else {
			r = mid - 1;
		}
	}
	return res;
}

int main() {
	int t;
	cin >> t;
	
	while (t--) {
		ll n;
		cin >> n;
		ll ans = mySqrt(n);
		cout << ans << '\n';
	}
	
	return 0;
}
0