結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 133 ms
54,164 KB
testcase_02 AC 138 ms
53,920 KB
testcase_03 AC 134 ms
54,128 KB
testcase_04 AC 141 ms
54,104 KB
testcase_05 AC 134 ms
53,948 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 138 ms
54,880 KB
testcase_10 AC 137 ms
54,288 KB
testcase_11 AC 139 ms
53,996 KB
testcase_12 AC 135 ms
53,844 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 161 ms
56,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 154 ms
56,000 KB
testcase_22 AC 167 ms
58,832 KB
testcase_23 AC 155 ms
56,268 KB
testcase_24 WA -
testcase_25 AC 167 ms
59,116 KB
testcase_26 AC 171 ms
58,644 KB
testcase_27 AC 165 ms
56,440 KB
testcase_28 AC 150 ms
56,044 KB
testcase_29 AC 171 ms
58,832 KB
testcase_30 AC 166 ms
56,300 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);
        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