結果

問題 No.312 置換処理
ユーザー _k_a_n_i__k_a_n_i_
提出日時 2015-12-06 22:57:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 1,906 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 58,152 KB
最終ジャッジ日時 2023-10-12 17:35:21
合計ジャッジ時間 9,047 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 122 ms
56,148 KB
testcase_02 AC 137 ms
55,808 KB
testcase_03 AC 122 ms
55,896 KB
testcase_04 AC 122 ms
55,840 KB
testcase_05 AC 121 ms
55,504 KB
testcase_06 WA -
testcase_07 AC 127 ms
55,772 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 128 ms
56,004 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 123 ms
56,128 KB
testcase_23 WA -
testcase_24 AC 122 ms
55,808 KB
testcase_25 AC 122 ms
55,584 KB
testcase_26 AC 123 ms
55,472 KB
testcase_27 AC 123 ms
56,196 KB
testcase_28 AC 122 ms
56,052 KB
testcase_29 AC 122 ms
55,884 KB
testcase_30 AC 123 ms
55,988 KB
testcase_31 WA -
testcase_32 AC 125 ms
55,908 KB
testcase_33 AC 129 ms
55,744 KB
testcase_34 AC 130 ms
55,668 KB
testcase_35 AC 123 ms
55,652 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 123 ms
55,804 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 122 ms
55,728 KB
testcase_43 AC 123 ms
53,640 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

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=2; i<=Math.sqrt(n)+1; ++i)
        {
            if(n%i == 0)
            {
                return i == 2 ? n/2 : i;
            }
        }
        return n;
    }
}
0