結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー RISE70226821
提出日時 2020-08-06 17:36:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 899 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 76,836 KB
実行使用メモリ 42,540 KB
最終ジャッジ日時 2024-09-21 14:26:18
合計ジャッジ時間 6,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

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