結果

問題 No.2417 Div Count
ユーザー tentententen
提出日時 2023-08-17 09:49:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,822 bytes
コンパイル時間 2,532 ms
コンパイル使用メモリ 89,164 KB
実行使用メモリ 38,068 KB
最終ジャッジ日時 2024-05-04 16:39:52
合計ジャッジ時間 5,526 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
37,228 KB
testcase_01 AC 50 ms
36,624 KB
testcase_02 AC 46 ms
37,212 KB
testcase_03 AC 46 ms
37,200 KB
testcase_04 AC 47 ms
37,212 KB
testcase_05 AC 47 ms
37,204 KB
testcase_06 AC 46 ms
36,652 KB
testcase_07 AC 46 ms
36,936 KB
testcase_08 AC 46 ms
37,216 KB
testcase_09 AC 46 ms
37,252 KB
testcase_10 AC 46 ms
36,976 KB
testcase_11 AC 47 ms
36,760 KB
testcase_12 AC 47 ms
36,940 KB
testcase_13 AC 48 ms
36,928 KB
testcase_14 AC 49 ms
36,964 KB
testcase_15 AC 47 ms
37,132 KB
testcase_16 AC 48 ms
36,936 KB
testcase_17 AC 49 ms
37,092 KB
testcase_18 AC 48 ms
37,196 KB
testcase_19 AC 48 ms
37,184 KB
testcase_20 AC 48 ms
37,180 KB
testcase_21 AC 47 ms
37,176 KB
testcase_22 AC 46 ms
37,228 KB
testcase_23 AC 46 ms
37,232 KB
testcase_24 AC 47 ms
37,176 KB
testcase_25 AC 47 ms
36,672 KB
testcase_26 AC 47 ms
37,188 KB
testcase_27 AC 50 ms
36,948 KB
testcase_28 AC 48 ms
37,064 KB
testcase_29 AC 52 ms
36,788 KB
testcase_30 AC 50 ms
37,220 KB
testcase_31 AC 46 ms
37,136 KB
testcase_32 AC 67 ms
37,532 KB
testcase_33 AC 54 ms
36,800 KB
testcase_34 AC 50 ms
37,188 KB
testcase_35 AC 59 ms
37,952 KB
testcase_36 AC 58 ms
37,952 KB
testcase_37 AC 66 ms
37,660 KB
testcase_38 AC 65 ms
38,068 KB
testcase_39 AC 61 ms
37,776 KB
testcase_40 AC 54 ms
37,488 KB
testcase_41 AC 51 ms
37,140 KB
testcase_42 AC 46 ms
37,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long n = sc.nextLong();
        long k = sc.nextLong();
        int ans = 0;
        for (long i = 1; i <= Math.sqrt(n - k); i++) {
            if ((n - k) % i == 0) {
                if (i > k) {
                    ans++;
                }
                if (i * i < n - k && (n - k) / i > k) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0