結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー RISE70226821RISE70226821
提出日時 2020-08-06 17:36:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 997 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 2,548 ms
コンパイル使用メモリ 86,304 KB
実行使用メモリ 58,500 KB
最終ジャッジ日時 2023-10-21 13:11:47
合計ジャッジ時間 7,388 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
57,852 KB
testcase_01 AC 152 ms
58,460 KB
testcase_02 AC 150 ms
58,308 KB
testcase_03 AC 153 ms
58,416 KB
testcase_04 AC 149 ms
58,368 KB
testcase_05 AC 151 ms
58,160 KB
testcase_06 AC 151 ms
58,132 KB
testcase_07 AC 845 ms
58,272 KB
testcase_08 AC 171 ms
58,328 KB
testcase_09 AC 997 ms
58,424 KB
testcase_10 AC 151 ms
58,376 KB
testcase_11 AC 140 ms
57,892 KB
testcase_12 AC 150 ms
58,364 KB
testcase_13 AC 168 ms
58,496 KB
testcase_14 AC 168 ms
58,500 KB
testcase_15 AC 153 ms
58,396 KB
testcase_16 AC 155 ms
58,192 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(n > 1){
			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++;
		}
		
		// 出力
		System.out.println(a + " " + b);
	}

}
0