結果

問題 No.1700 floor X
コンテスト
ユーザー xsd
提出日時 2022-07-17 01:20:46
言語 OCaml
(5.4.1)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 486 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,347 ms
コンパイル使用メモリ 22,724 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-18 11:41:26
合計ジャッジ時間 2,556 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

Scanf.scanf "%d" (fun t ->
    for i = 1 to t do
        Scanf.scanf " %d" (fun n ->
            let nf2 = int_of_float (sqrt (float n)) - 2 in
            let nf1 = nf2 + 1 in
            let nf0 = nf1 + 1 in
            let nfm = nf0 + 1 in
            Printf.printf "%d\n" @@
            if nf2 * nf2 <= n && n < nf1 * nf1 then nf2 else
            if nf1 * nf1 <= n && n < nf0 * nf0 then nf1 else
            if nf0 * nf0 <= n && n < nfm * nfm then nf0 else nfm
        )
    done
)
0