結果

問題 No.300 平方数
ユーザー SaYaSaYa
提出日時 2015-11-13 23:27:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 72,420 KB
実行使用メモリ 58,384 KB
最終ジャッジ日時 2023-10-11 16:46:09
合計ジャッジ時間 10,281 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,744 KB
testcase_01 AC 121 ms
56,016 KB
testcase_02 AC 129 ms
55,880 KB
testcase_03 AC 120 ms
53,948 KB
testcase_04 AC 118 ms
55,356 KB
testcase_05 AC 119 ms
55,956 KB
testcase_06 AC 118 ms
55,388 KB
testcase_07 AC 117 ms
56,388 KB
testcase_08 AC 117 ms
55,356 KB
testcase_09 AC 118 ms
55,576 KB
testcase_10 AC 121 ms
56,008 KB
testcase_11 AC 119 ms
55,720 KB
testcase_12 AC 119 ms
55,572 KB
testcase_13 WA -
testcase_14 AC 119 ms
57,592 KB
testcase_15 AC 119 ms
55,932 KB
testcase_16 WA -
testcase_17 AC 120 ms
55,672 KB
testcase_18 AC 119 ms
56,080 KB
testcase_19 AC 121 ms
55,992 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long x = Long.parseLong(scanner.next());
        long y = 1;
        while (true) {
            long z = (x * y);
            if (isSquare(z)) {
                break;
            }
            y++;
        }
        System.out.print(y);
    }

    private static boolean isSquare(long z) {
        double sqrt = Math.floor(Math.sqrt(z));
        return (sqrt * sqrt) == z;
    }
}
0