結果

問題 No.312 置換処理
ユーザー _k_a_n_i__k_a_n_i_
提出日時 2015-12-06 23:01:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 71,640 KB
実行使用メモリ 57,988 KB
最終ジャッジ日時 2023-10-12 17:35:36
合計ジャッジ時間 9,129 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,584 KB
testcase_01 WA -
testcase_02 AC 134 ms
56,176 KB
testcase_03 WA -
testcase_04 AC 118 ms
55,752 KB
testcase_05 AC 120 ms
55,664 KB
testcase_06 AC 122 ms
55,916 KB
testcase_07 AC 127 ms
55,572 KB
testcase_08 AC 119 ms
55,680 KB
testcase_09 AC 121 ms
55,452 KB
testcase_10 AC 121 ms
55,888 KB
testcase_11 AC 125 ms
55,820 KB
testcase_12 AC 119 ms
56,024 KB
testcase_13 AC 123 ms
55,972 KB
testcase_14 AC 119 ms
55,980 KB
testcase_15 AC 119 ms
56,032 KB
testcase_16 AC 120 ms
56,248 KB
testcase_17 AC 119 ms
56,132 KB
testcase_18 AC 120 ms
55,776 KB
testcase_19 AC 121 ms
56,084 KB
testcase_20 AC 120 ms
55,944 KB
testcase_21 AC 126 ms
55,724 KB
testcase_22 AC 120 ms
55,580 KB
testcase_23 AC 120 ms
55,796 KB
testcase_24 AC 120 ms
55,652 KB
testcase_25 AC 120 ms
55,580 KB
testcase_26 AC 119 ms
55,880 KB
testcase_27 WA -
testcase_28 AC 120 ms
56,148 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 122 ms
56,020 KB
testcase_32 AC 126 ms
55,748 KB
testcase_33 AC 127 ms
55,800 KB
testcase_34 AC 129 ms
55,920 KB
testcase_35 AC 122 ms
55,912 KB
testcase_36 AC 122 ms
55,456 KB
testcase_37 AC 123 ms
56,208 KB
testcase_38 AC 120 ms
55,896 KB
testcase_39 AC 121 ms
55,624 KB
testcase_40 AC 120 ms
56,284 KB
testcase_41 AC 121 ms
57,988 KB
testcase_42 AC 122 ms
55,592 KB
testcase_43 AC 120 ms
55,948 KB
testcase_44 AC 122 ms
56,064 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 n%2 == 0 ? Math.min(i, n/2) : i;
            }
        }
        return n;
    }
}
0