結果

問題 No.1791 Repeat Multiplication
ユーザー tnakao0123tnakao0123
提出日時 2021-12-24 13:22:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 3,000 ms
コード長 678 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 41,496 KB
実行使用メモリ 26,684 KB
最終ジャッジ日時 2023-10-19 15:19:13
合計ジャッジ時間 6,470 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,296 KB
testcase_01 AC 2 ms
5,296 KB
testcase_02 AC 2 ms
5,308 KB
testcase_03 AC 2 ms
5,296 KB
testcase_04 AC 2 ms
5,296 KB
testcase_05 AC 2 ms
5,296 KB
testcase_06 AC 2 ms
5,296 KB
testcase_07 AC 2 ms
5,296 KB
testcase_08 AC 25 ms
8,012 KB
testcase_09 AC 22 ms
5,956 KB
testcase_10 AC 22 ms
5,948 KB
testcase_11 AC 20 ms
5,892 KB
testcase_12 AC 12 ms
5,652 KB
testcase_13 AC 86 ms
26,444 KB
testcase_14 AC 86 ms
25,384 KB
testcase_15 AC 68 ms
19,408 KB
testcase_16 AC 67 ms
19,024 KB
testcase_17 AC 89 ms
26,084 KB
testcase_18 AC 78 ms
21,648 KB
testcase_19 AC 83 ms
24,600 KB
testcase_20 AC 70 ms
20,160 KB
testcase_21 AC 85 ms
24,332 KB
testcase_22 AC 91 ms
26,196 KB
testcase_23 AC 73 ms
20,536 KB
testcase_24 AC 87 ms
25,224 KB
testcase_25 AC 82 ms
23,532 KB
testcase_26 AC 87 ms
25,656 KB
testcase_27 AC 76 ms
21,604 KB
testcase_28 AC 95 ms
26,680 KB
testcase_29 AC 94 ms
26,672 KB
testcase_30 AC 98 ms
26,680 KB
testcase_31 AC 2 ms
5,028 KB
testcase_32 AC 92 ms
26,684 KB
testcase_33 AC 97 ms
26,684 KB
testcase_34 AC 99 ms
26,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1791.cc:  No.1791 Repeat Multiplication - yukicoder
 */

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

/* constant */

const int MAX_N = 1500000;

/* typedef */

typedef long long ll;

/* global variables */

ll dp[MAX_N + 1], dps[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int n, qn;
  scanf("%d%d", &n, &qn);

  dp[1] = dps[1] = 1;
  for (int i = 1; i * 2 <= n; i++)
    for (int j = 2; i * j <= n; j++) dp[i * j] += dp[i];
  for (int i = 1; i <= n; i++) dps[i] = dps[i - 1] + dp[i];

  while (qn--) {
    int xi;
    scanf("%d", &xi);

    ll v = dp[xi] * dps[n / xi];
    printf("%lld\n", v);
  }

  return 0;
}
0