結果

問題 No.1700 floor X
ユーザー moharan627moharan627
提出日時 2021-10-08 22:02:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 1,407 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 78,552 KB
最終ジャッジ日時 2023-09-16 09:09:49
合計ジャッジ時間 7,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,504 KB
testcase_01 AC 123 ms
78,316 KB
testcase_02 AC 126 ms
78,408 KB
testcase_03 AC 126 ms
78,448 KB
testcase_04 AC 127 ms
78,244 KB
testcase_05 AC 123 ms
78,372 KB
testcase_06 AC 123 ms
78,440 KB
testcase_07 AC 123 ms
78,220 KB
testcase_08 AC 124 ms
78,356 KB
testcase_09 AC 125 ms
78,424 KB
testcase_10 AC 124 ms
78,552 KB
testcase_11 AC 127 ms
78,012 KB
testcase_12 AC 126 ms
78,300 KB
testcase_13 AC 124 ms
78,124 KB
testcase_14 AC 126 ms
78,176 KB
testcase_15 AC 125 ms
78,228 KB
testcase_16 AC 127 ms
78,324 KB
testcase_17 AC 124 ms
78,388 KB
testcase_18 AC 125 ms
78,420 KB
testcase_19 AC 129 ms
78,128 KB
testcase_20 AC 124 ms
78,472 KB
testcase_21 AC 128 ms
78,292 KB
testcase_22 AC 131 ms
78,164 KB
testcase_23 AC 126 ms
77,960 KB
testcase_24 AC 129 ms
78,208 KB
testcase_25 AC 127 ms
78,008 KB
testcase_26 AC 130 ms
78,384 KB
testcase_27 AC 128 ms
78,216 KB
testcase_28 AC 128 ms
78,100 KB
testcase_29 AC 132 ms
78,172 KB
testcase_30 AC 128 ms
78,220 KB
testcase_31 AC 129 ms
78,428 KB
testcase_32 AC 134 ms
78,248 KB
testcase_33 AC 126 ms
78,284 KB
testcase_34 AC 128 ms
78,284 KB
testcase_35 AC 131 ms
78,108 KB
testcase_36 AC 131 ms
78,216 KB
testcase_37 AC 132 ms
78,216 KB
testcase_38 AC 131 ms
78,224 KB
testcase_39 AC 130 ms
78,048 KB
testcase_40 AC 129 ms
78,160 KB
testcase_41 AC 133 ms
78,308 KB
testcase_42 AC 93 ms
71,608 KB
testcase_43 AC 128 ms
78,104 KB
testcase_44 AC 128 ms
78,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(10 ** 6)
INF = float('inf')
#10**20,2**63に変えるのもあり
MOD = 10**9 + 7
MOD2 = 998244353
from collections import defaultdict
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(input())
    def IC(): return [int(c) for c in input()]
    def MI(): return map(int, sys.stdin.readline().split())
    T = II()
    def meguru_bisect(ng, ok):
        """
        この条件は、問題に基づくやつじゃなくてもOK
        条件の付け方は、ngとokの広げ方をどのようにするかで決まってくる。

        負の無限~(目的値)が条件を満たす場合
        ng…条件を満たさない値の範囲での最小値
        ok…条件を満たす値の範囲での最大値
        ok < ng
        is_ok == Trueの場合、探索範囲が右半分へ
        is_ok == Falseの場合、探索範囲が左半分へ
        """
        while (abs(ok - ng) > 1):
            mid = (ok + ng) // 2
            if is_ok(mid):
                ok = mid
            else:
                ng = mid
        return ok
    for _ in range(T):
        N = II()
        def is_ok(arg):
            # 条件を満たすかどうか?問題ごとに定義
            return arg**2<=N
        print(meguru_bisect(10**10, 0))
    return
solve()
0