結果

問題 No.312 置換処理
ユーザー takeya_okinotakeya_okino
提出日時 2019-09-10 19:29:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2023-09-15 13:07:23
合計ジャッジ時間 9,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
56,328 KB
testcase_01 AC 138 ms
56,000 KB
testcase_02 AC 140 ms
55,752 KB
testcase_03 AC 142 ms
56,020 KB
testcase_04 AC 127 ms
56,048 KB
testcase_05 AC 140 ms
55,720 KB
testcase_06 AC 135 ms
55,784 KB
testcase_07 AC 142 ms
56,004 KB
testcase_08 AC 136 ms
55,916 KB
testcase_09 AC 134 ms
55,712 KB
testcase_10 AC 134 ms
55,712 KB
testcase_11 AC 137 ms
55,712 KB
testcase_12 AC 136 ms
55,908 KB
testcase_13 AC 139 ms
55,884 KB
testcase_14 AC 140 ms
55,712 KB
testcase_15 AC 139 ms
55,560 KB
testcase_16 AC 133 ms
56,008 KB
testcase_17 AC 137 ms
55,872 KB
testcase_18 AC 137 ms
55,772 KB
testcase_19 AC 140 ms
55,672 KB
testcase_20 AC 140 ms
56,120 KB
testcase_21 AC 142 ms
56,064 KB
testcase_22 AC 125 ms
56,248 KB
testcase_23 WA -
testcase_24 AC 122 ms
54,144 KB
testcase_25 AC 124 ms
56,064 KB
testcase_26 AC 125 ms
55,964 KB
testcase_27 AC 125 ms
55,880 KB
testcase_28 AC 126 ms
56,068 KB
testcase_29 AC 126 ms
55,516 KB
testcase_30 AC 130 ms
55,932 KB
testcase_31 AC 133 ms
55,708 KB
testcase_32 AC 131 ms
55,908 KB
testcase_33 AC 132 ms
55,876 KB
testcase_34 AC 135 ms
55,724 KB
testcase_35 AC 132 ms
55,784 KB
testcase_36 AC 123 ms
56,300 KB
testcase_37 AC 123 ms
56,352 KB
testcase_38 AC 123 ms
55,704 KB
testcase_39 AC 131 ms
55,928 KB
testcase_40 AC 125 ms
55,936 KB
testcase_41 AC 128 ms
55,580 KB
testcase_42 AC 126 ms
56,388 KB
testcase_43 AC 125 ms
56,064 KB
testcase_44 AC 124 ms
55,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long ans = (long)Math.pow(10, 18);
    for(long i = 2; (i * i) <= n; i++) {
      if((n % i) == 0) {
        if(i == 2) {
          ans = Math.min(n / 2, ans);
        } else {
          ans = Math.min(ans, i);
        }
      }
    }
    if(ans == Math.pow(10, 18)) ans = n;
    System.out.println(ans);
  }
}
0