結果

問題 No.414 衝動
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 03:50:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 497 bytes
コンパイル時間 2,641 ms
コンパイル使用メモリ 76,380 KB
実行使用メモリ 55,248 KB
最終ジャッジ日時 2024-04-27 08:29:35
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,036 KB
testcase_01 AC 114 ms
55,248 KB
testcase_02 AC 137 ms
54,832 KB
testcase_03 AC 141 ms
55,164 KB
testcase_04 AC 124 ms
54,128 KB
testcase_05 AC 123 ms
53,424 KB
testcase_06 AC 135 ms
54,260 KB
testcase_07 AC 126 ms
54,160 KB
testcase_08 AC 120 ms
53,248 KB
testcase_09 AC 134 ms
54,576 KB
testcase_10 AC 110 ms
53,132 KB
testcase_11 AC 130 ms
55,052 KB
testcase_12 AC 132 ms
54,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long M = sc.nextLong();
        if(M%2==0){
            System.out.println(2+ " "+M/2);
            return;
        }
        long rt = (long)Math.sqrt(M);
        for(long i=3; i<=rt; i=i+2){
            if(M%i==0){
                System.out.println(i+ " "+M/i);
                return;
            }
        }
        System.out.println(M+ " "+1);
    }
}
0