結果

問題 No.312 置換処理
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-10 01:37:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 4,116 ms
コンパイル使用メモリ 74,508 KB
実行使用メモリ 37,656 KB
最終ジャッジ日時 2024-04-17 15:15:58
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
36,960 KB
testcase_01 AC 63 ms
37,656 KB
testcase_02 AC 65 ms
37,576 KB
testcase_03 AC 63 ms
37,552 KB
testcase_04 AC 43 ms
36,972 KB
testcase_05 AC 44 ms
37,116 KB
testcase_06 AC 46 ms
37,156 KB
testcase_07 AC 54 ms
37,352 KB
testcase_08 AC 44 ms
37,208 KB
testcase_09 AC 46 ms
37,068 KB
testcase_10 AC 43 ms
36,896 KB
testcase_11 AC 46 ms
36,888 KB
testcase_12 AC 45 ms
36,964 KB
testcase_13 AC 44 ms
36,844 KB
testcase_14 AC 44 ms
36,548 KB
testcase_15 AC 44 ms
36,900 KB
testcase_16 AC 44 ms
36,980 KB
testcase_17 AC 48 ms
36,916 KB
testcase_18 AC 43 ms
36,644 KB
testcase_19 AC 44 ms
36,540 KB
testcase_20 AC 46 ms
36,908 KB
testcase_21 AC 44 ms
36,996 KB
testcase_22 AC 44 ms
36,896 KB
testcase_23 WA -
testcase_24 AC 43 ms
37,132 KB
testcase_25 AC 42 ms
36,984 KB
testcase_26 AC 43 ms
36,536 KB
testcase_27 AC 45 ms
37,128 KB
testcase_28 AC 45 ms
37,072 KB
testcase_29 AC 47 ms
36,784 KB
testcase_30 AC 48 ms
36,948 KB
testcase_31 AC 47 ms
37,148 KB
testcase_32 AC 46 ms
37,120 KB
testcase_33 AC 55 ms
37,104 KB
testcase_34 AC 57 ms
37,172 KB
testcase_35 AC 44 ms
37,072 KB
testcase_36 AC 43 ms
37,156 KB
testcase_37 AC 43 ms
36,904 KB
testcase_38 AC 43 ms
37,136 KB
testcase_39 AC 44 ms
37,080 KB
testcase_40 AC 44 ms
36,920 KB
testcase_41 AC 43 ms
37,132 KB
testcase_42 AC 43 ms
36,836 KB
testcase_43 AC 43 ms
36,968 KB
testcase_44 AC 45 ms
36,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Exercise75{
  public static void main (String[] args) throws IOException{

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String nStr = new String(in.readLine());

    long nd = Long.parseLong(nStr);
    long n = nd;

    long[] factor = new long[20];
    int count = 0;



    for (long i = 3; i * i <= n; i ++){
      if(n % i == 0){
        while (n % i == 0){
          factor[count] = i;
          n /= i;
        }
        count++;
      }
    }

    if (factor[0] > 2){
      System.out.println(factor[0]);
    }else{
      if(n % 2 == 0){
        System.out.println(n / 2);
      }else{
        System.out.println(n);
      }
    }
  }
}
0