結果

問題 No.2417 Div Count
ユーザー hiromi_ayasehiromi_ayase
提出日時 2023-08-12 14:28:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 2,192 bytes
コンパイル時間 2,469 ms
コンパイル使用メモリ 79,068 KB
実行使用メモリ 51,388 KB
最終ジャッジ日時 2024-04-30 06:10:37
合計ジャッジ時間 6,115 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
50,720 KB
testcase_01 AC 53 ms
50,256 KB
testcase_02 AC 52 ms
50,676 KB
testcase_03 AC 52 ms
50,584 KB
testcase_04 AC 53 ms
50,388 KB
testcase_05 AC 53 ms
50,876 KB
testcase_06 AC 54 ms
50,504 KB
testcase_07 AC 54 ms
50,608 KB
testcase_08 AC 53 ms
50,644 KB
testcase_09 AC 54 ms
50,688 KB
testcase_10 AC 53 ms
50,760 KB
testcase_11 AC 53 ms
50,580 KB
testcase_12 AC 54 ms
50,364 KB
testcase_13 AC 54 ms
50,632 KB
testcase_14 AC 54 ms
50,764 KB
testcase_15 AC 53 ms
50,628 KB
testcase_16 AC 54 ms
50,644 KB
testcase_17 AC 54 ms
50,608 KB
testcase_18 AC 54 ms
50,616 KB
testcase_19 AC 54 ms
50,332 KB
testcase_20 AC 54 ms
50,632 KB
testcase_21 AC 54 ms
50,296 KB
testcase_22 AC 53 ms
50,372 KB
testcase_23 AC 54 ms
50,684 KB
testcase_24 AC 54 ms
50,512 KB
testcase_25 AC 54 ms
50,316 KB
testcase_26 AC 54 ms
50,720 KB
testcase_27 AC 55 ms
50,732 KB
testcase_28 AC 54 ms
50,648 KB
testcase_29 AC 55 ms
50,544 KB
testcase_30 AC 57 ms
50,700 KB
testcase_31 AC 54 ms
50,356 KB
testcase_32 AC 61 ms
50,992 KB
testcase_33 AC 61 ms
51,268 KB
testcase_34 AC 59 ms
50,756 KB
testcase_35 AC 64 ms
51,120 KB
testcase_36 AC 64 ms
51,388 KB
testcase_37 AC 62 ms
51,284 KB
testcase_38 AC 69 ms
51,084 KB
testcase_39 AC 63 ms
51,308 KB
testcase_40 AC 61 ms
51,244 KB
testcase_41 AC 60 ms
51,156 KB
testcase_42 AC 54 ms
50,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

@SuppressWarnings("unused")
public class Main {

  private static void solve() {
    long n = nl();
    long k = nl();

    // n % a = k
    // n = ax + k
    n -= k;

    Set<Long> set = new HashSet<>();
    for (long i = 1; i * i <= n; i ++) {
      if (n % i != 0) continue;
      long j = n / i;


      if (i > k) {
        set.add(i);
      }
      if (j > k) {
        set.add(j);
      }
    }
    System.out.println(set.size());
    
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        solve();
        out.flush();
      }
    }, "", 64000000).start();
  }

  private static PrintWriter out = new PrintWriter(System.out);
  private static StringTokenizer tokenizer = null;
  private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }
}
0