結果

問題 No.1700 floor X
ユーザー tentententen
提出日時 2021-10-11 13:43:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 3,034 ms
コンパイル使用メモリ 73,900 KB
実行使用メモリ 55,316 KB
最終ジャッジ日時 2023-09-16 09:27:32
合計ジャッジ時間 10,940 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,368 KB
testcase_01 AC 133 ms
53,644 KB
testcase_02 AC 122 ms
52,384 KB
testcase_03 AC 134 ms
53,932 KB
testcase_04 AC 132 ms
54,464 KB
testcase_05 AC 132 ms
53,188 KB
testcase_06 AC 134 ms
53,464 KB
testcase_07 AC 133 ms
54,916 KB
testcase_08 AC 133 ms
53,764 KB
testcase_09 AC 134 ms
54,036 KB
testcase_10 AC 135 ms
53,944 KB
testcase_11 AC 133 ms
54,132 KB
testcase_12 AC 135 ms
54,400 KB
testcase_13 AC 134 ms
52,892 KB
testcase_14 AC 133 ms
54,132 KB
testcase_15 AC 137 ms
54,216 KB
testcase_16 AC 135 ms
55,316 KB
testcase_17 AC 134 ms
53,860 KB
testcase_18 AC 133 ms
54,224 KB
testcase_19 AC 133 ms
53,352 KB
testcase_20 AC 133 ms
54,412 KB
testcase_21 AC 147 ms
54,120 KB
testcase_22 AC 149 ms
53,996 KB
testcase_23 AC 150 ms
54,672 KB
testcase_24 AC 147 ms
53,928 KB
testcase_25 AC 148 ms
53,976 KB
testcase_26 AC 151 ms
53,964 KB
testcase_27 AC 149 ms
54,276 KB
testcase_28 AC 147 ms
54,372 KB
testcase_29 AC 150 ms
54,564 KB
testcase_30 AC 148 ms
54,472 KB
testcase_31 AC 151 ms
54,432 KB
testcase_32 AC 150 ms
54,532 KB
testcase_33 AC 148 ms
54,028 KB
testcase_34 AC 148 ms
54,820 KB
testcase_35 AC 148 ms
54,764 KB
testcase_36 AC 150 ms
54,520 KB
testcase_37 AC 150 ms
54,324 KB
testcase_38 AC 149 ms
54,144 KB
testcase_39 AC 149 ms
54,232 KB
testcase_40 AC 150 ms
54,176 KB
testcase_41 AC 148 ms
54,412 KB
testcase_42 AC 42 ms
49,024 KB
testcase_43 AC 147 ms
54,476 KB
testcase_44 AC 151 ms
54,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            long x = sc.nextLong();
            long left = 0;
            long right = (long)(Math.sqrt(Long.MAX_VALUE));
            while (right - left > 1) {
                long m = (left + right) / 2;
                if (m * m > x) {
                    right = m;
                } else {
                    left = m;
                }
            }
            sb.append(left).append("\n");
        }
        System.out.print(sb);
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0