結果

問題 No.2051 Divide
ユーザー tnakao0123
提出日時 2022-08-21 15:53:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 41,156 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-10 06:13:43
合計ジャッジ時間 1,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2051.cc:  No.2051 Divide - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int a, b;
  scanf("%d%d", &a, &b);

  int c = 0;
  for (int p = 1; p * p <= a; p++)
    if (a % p == 0) {
      int q = a / p;
      if (p % b == 0) c++;
      if (q != p && q % b == 0) c++;
    }

  printf("%d\n", c);
  return 0;
}
0