結果

問題 No.537 ユーザーID
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-06-30 23:07:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,423 bytes
コンパイル時間 2,605 ms
コンパイル使用メモリ 78,588 KB
実行使用メモリ 59,284 KB
最終ジャッジ日時 2024-04-15 06:59:22
合計ジャッジ時間 8,206 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,220 KB
testcase_01 AC 130 ms
41,132 KB
testcase_02 AC 132 ms
41,384 KB
testcase_03 AC 129 ms
41,284 KB
testcase_04 AC 129 ms
41,292 KB
testcase_05 AC 129 ms
41,496 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 125 ms
41,172 KB
testcase_10 AC 126 ms
41,604 KB
testcase_11 AC 118 ms
40,752 KB
testcase_12 AC 126 ms
41,568 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 152 ms
44,416 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 149 ms
43,332 KB
testcase_22 AC 160 ms
47,108 KB
testcase_23 AC 150 ms
43,424 KB
testcase_24 WA -
testcase_25 AC 150 ms
46,248 KB
testcase_26 AC 162 ms
48,948 KB
testcase_27 AC 155 ms
45,968 KB
testcase_28 AC 149 ms
42,876 KB
testcase_29 AC 164 ms
47,804 KB
testcase_30 AC 158 ms
43,996 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        solve(N);
    }
    static void solve(long N){
        ArrayList<Integer> prime = prime(N);
        int [] num = decomposition(N,prime);
        long ans=1;
        for(int i=0; i<num.length; i++){
            ans*=(num[i]+1);
        }
        System.out.println(ans);
    }
    static ArrayList<Integer> prime(long N){
        int UP = (int)Math.sqrt(N)+1;
        boolean [] b = new boolean [UP+1];
        ArrayList<Integer> prime = new ArrayList<>();
        prime.add(2);
        for(int i=3; i<=UP; i+=2){
            if(b[i]==false){
                prime.add(i);
                int X=3*i;
                int Y=2*i;
                while(X<=UP){
                    b[X]=true;
                    X+=Y;
                }
            }
        }
        //for(int i=0; i<prime.size(); i++)System.out.println(prime.get(i));
        return prime;
    }
    static int[] decomposition(long N, ArrayList<Integer> prime){
        int [] num = new int [prime.size()];
        for(int i=0; i<prime.size(); i++){
            int tmp = prime.get(i);
            while(N%tmp==0){
                num[i]++;
                N/=tmp;
            }
            //if(num[i]!=0)System.out.println(prime.get(i)+" "+num[i]);
        }
        return num;
    }
}
0