結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-29 15:20:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 3,233 ms
コンパイル使用メモリ 76,240 KB
実行使用メモリ 61,864 KB
最終ジャッジ日時 2024-05-06 23:14:40
合計ジャッジ時間 7,890 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
47,900 KB
testcase_01 AC 143 ms
41,468 KB
testcase_02 AC 150 ms
42,240 KB
testcase_03 AC 161 ms
42,560 KB
testcase_04 AC 153 ms
42,760 KB
testcase_05 AC 149 ms
42,792 KB
testcase_06 WA -
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class HelloWorld {
		public static void main (String[] args) {
			Scanner sc = new Scanner(System.in);
			double n = sc.nextDouble();
			sc.close();

			boolean flag = false;

			for (int b = 0; b <= Math.sqrt(n); b ++) {
				for (int a = 0; a <= Math.sqrt(n); a ++) {
					if (a * a * b == n) {
						flag = true;
						System.out.println(a + " " + b);
						break;
					}
				}
				if (flag == true) {
					break;
				}
			}
			if (flag == false) {
				System.out.println(1 + " " + (int)n);
			}
	}
}
0