結果

問題 No.312 置換処理
ユーザー _k_a_n_i__k_a_n_i_
提出日時 2015-12-10 20:51:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 74,216 KB
実行使用メモリ 54,428 KB
最終ジャッジ日時 2024-04-27 10:37:42
合計ジャッジ時間 8,112 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
53,956 KB
testcase_01 AC 120 ms
53,972 KB
testcase_02 AC 121 ms
52,984 KB
testcase_03 AC 115 ms
53,260 KB
testcase_04 AC 115 ms
54,360 KB
testcase_05 AC 109 ms
54,152 KB
testcase_06 AC 106 ms
52,856 KB
testcase_07 AC 121 ms
54,300 KB
testcase_08 AC 114 ms
54,000 KB
testcase_09 AC 107 ms
52,732 KB
testcase_10 AC 102 ms
53,020 KB
testcase_11 AC 109 ms
53,828 KB
testcase_12 AC 123 ms
54,212 KB
testcase_13 AC 115 ms
54,228 KB
testcase_14 AC 105 ms
52,948 KB
testcase_15 AC 113 ms
54,200 KB
testcase_16 AC 105 ms
53,112 KB
testcase_17 AC 114 ms
53,892 KB
testcase_18 AC 114 ms
54,044 KB
testcase_19 AC 108 ms
53,552 KB
testcase_20 AC 117 ms
54,020 KB
testcase_21 AC 115 ms
54,100 KB
testcase_22 AC 105 ms
53,076 KB
testcase_23 AC 105 ms
54,156 KB
testcase_24 AC 117 ms
54,012 KB
testcase_25 AC 105 ms
52,992 KB
testcase_26 AC 118 ms
53,884 KB
testcase_27 AC 103 ms
52,888 KB
testcase_28 AC 118 ms
53,836 KB
testcase_29 AC 111 ms
54,144 KB
testcase_30 AC 110 ms
53,104 KB
testcase_31 AC 122 ms
54,072 KB
testcase_32 AC 122 ms
54,004 KB
testcase_33 AC 117 ms
54,152 KB
testcase_34 AC 109 ms
52,844 KB
testcase_35 AC 100 ms
52,524 KB
testcase_36 AC 114 ms
54,144 KB
testcase_37 AC 117 ms
54,072 KB
testcase_38 AC 103 ms
52,704 KB
testcase_39 AC 108 ms
53,768 KB
testcase_40 AC 108 ms
54,012 KB
testcase_41 AC 116 ms
54,164 KB
testcase_42 AC 102 ms
52,716 KB
testcase_43 AC 98 ms
53,020 KB
testcase_44 AC 117 ms
54,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main
{
    private final static Main main = new Main();

    public static void main(String[] args)
    {
        main.contest();
    }

    private void contest()
    {
        Scanner sc = new Scanner(System.in);
        System.out.println(solve(sc.nextLong()));
    }

    private long solve(long n)
    {
        for(int i=3; i<=Math.sqrt(n)+1; ++i)
        {
            if(n%i == 0)
            {
                return i;
            }
        }
        return n%2 == 0 && n/2 != 2 ? n/2 : n;
    }
}
0