結果
問題 | No.1700 floor X |
ユーザー |
|
提出日時 | 2022-12-20 11:50:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 97 ms / 2,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-18 01:45:37 |
合計ジャッジ時間 | 6,465 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 44 |
ソースコード
from math import sqrt, floordef is_sqrt_floor(n: int, x: int) -> bool:if x < 0:return Falsereturn (x+1) ** 2 > n >= x**2def main():T = int(input())for _ in range(T):N = int(input())floor_candidate = floor(sqrt(N))for diff in range(-1, 3):if is_sqrt_floor(N, floor_candidate+diff):print(floor_candidate+diff)breakelse:raise ValueErrorif __name__ == "__main__":main()