結果

問題 No.1791 Repeat Multiplication
ユーザー ace_amuroace_amuro
提出日時 2023-04-13 18:08:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 146 ms / 3,000 ms
コード長 569 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 81,248 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-04-17 22:00:48
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 25 ms
5,376 KB
testcase_09 AC 23 ms
5,376 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 21 ms
5,376 KB
testcase_12 AC 13 ms
5,376 KB
testcase_13 AC 126 ms
25,344 KB
testcase_14 AC 131 ms
25,984 KB
testcase_15 AC 87 ms
19,968 KB
testcase_16 AC 81 ms
19,456 KB
testcase_17 AC 133 ms
26,752 KB
testcase_18 AC 114 ms
22,016 KB
testcase_19 AC 137 ms
25,088 KB
testcase_20 AC 92 ms
20,480 KB
testcase_21 AC 129 ms
24,704 KB
testcase_22 AC 146 ms
26,624 KB
testcase_23 AC 102 ms
20,864 KB
testcase_24 AC 130 ms
25,856 KB
testcase_25 AC 107 ms
24,192 KB
testcase_26 AC 136 ms
26,112 KB
testcase_27 AC 93 ms
22,272 KB
testcase_28 AC 131 ms
27,008 KB
testcase_29 AC 125 ms
27,216 KB
testcase_30 AC 140 ms
27,264 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 123 ms
27,264 KB
testcase_33 AC 135 ms
27,264 KB
testcase_34 AC 134 ms
27,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<ctime>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long LL;
const int MR=1.5e6+10;
int n,Q,x;
LL dp[MR],s[MR];
int main(){
    scanf("%d%d",&n,&Q);
    dp[1] = 1;
    for(int i=1;i<=n;i++) {
        for(int j=2*i;j<=n;j+=i){
            dp[j] += dp[i];
        }
        s[i] = s[i-1] + dp[i];
    }
    while(Q--){
        scanf("%d",&x);
        printf("%lld\n",dp[x]*s[n/x]);
    }
    return 0;
}
0