結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー RISE70226821RISE70226821
提出日時 2020-08-06 17:42:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,332 ms
コンパイル使用メモリ 76,328 KB
実行使用メモリ 58,392 KB
最終ジャッジ日時 2023-10-21 13:24:05
合計ジャッジ時間 5,986 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
56,404 KB
testcase_01 AC 156 ms
58,280 KB
testcase_02 AC 155 ms
58,344 KB
testcase_03 AC 154 ms
58,288 KB
testcase_04 AC 154 ms
56,380 KB
testcase_05 AC 164 ms
58,332 KB
testcase_06 AC 159 ms
58,352 KB
testcase_07 AC 157 ms
58,212 KB
testcase_08 AC 157 ms
58,232 KB
testcase_09 AC 155 ms
58,240 KB
testcase_10 AC 155 ms
58,304 KB
testcase_11 AC 157 ms
58,328 KB
testcase_12 AC 155 ms
58,356 KB
testcase_13 AC 157 ms
58,280 KB
testcase_14 AC 141 ms
57,872 KB
testcase_15 AC 154 ms
58,272 KB
testcase_16 AC 157 ms
58,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		// 計算
		int a = 1;
		int b = 1;
		int x = 2;
		while(x*x <= n){
			int count = 0;
			while(n % x == 0){
				count++;
				n = n / x;
			}
			
			for(int i = 0; i < count / 2; i++){
				a *= x;
			}
			if(count % 2 == 1){
				b *= x;
			}
			x++;
		}
		b *= n;
		
		// 出力
		System.out.println(a + " " + b);
	}

}
0