結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー RISE70226821
提出日時 2020-08-06 17:42:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 76,760 KB
実行使用メモリ 42,588 KB
最終ジャッジ日時 2024-09-21 14:38:07
合計ジャッジ時間 5,687 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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(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