結果
| 問題 |
No.1791 Repeat Multiplication
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2021-12-24 13:22:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 106 ms / 3,000 ms |
| コード長 | 678 bytes |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 41,796 KB |
| 実行使用メモリ | 26,580 KB |
| 最終ジャッジ日時 | 2024-09-19 11:26:36 |
| 合計ジャッジ時間 | 5,464 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
/* -*- 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;
}
tnakao0123