結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
54,276 KB
testcase_01 AC 130 ms
54,172 KB
testcase_02 AC 130 ms
54,168 KB
testcase_03 AC 129 ms
54,228 KB
testcase_04 AC 130 ms
53,968 KB
testcase_05 AC 133 ms
54,088 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 130 ms
54,180 KB
testcase_10 AC 131 ms
54,540 KB
testcase_11 AC 131 ms
53,876 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 152 ms
56,048 KB
testcase_19 AC 168 ms
58,792 KB
testcase_20 AC 160 ms
56,608 KB
testcase_21 AC 151 ms
56,208 KB
testcase_22 AC 162 ms
59,064 KB
testcase_23 AC 148 ms
56,032 KB
testcase_24 AC 142 ms
54,068 KB
testcase_25 AC 161 ms
58,948 KB
testcase_26 AC 162 ms
59,024 KB
testcase_27 AC 152 ms
56,216 KB
testcase_28 AC 150 ms
56,212 KB
testcase_29 AC 161 ms
58,868 KB
testcase_30 AC 165 ms
56,004 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()+1];
        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]);
        }
        if(N!=1)num[prime.size()]++;
        return num;
    }
}
0