結果

問題 No.1791 Repeat Multiplication
ユーザー ripityripity
提出日時 2021-11-21 15:43:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 286 ms / 3,000 ms
コード長 435 bytes
コンパイル時間 1,592 ms
コンパイル使用メモリ 166,304 KB
実行使用メモリ 26,564 KB
最終ジャッジ日時 2023-10-13 19:05:41
合計ジャッジ時間 9,913 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 160 ms
4,612 KB
testcase_09 AC 142 ms
4,360 KB
testcase_10 AC 140 ms
4,352 KB
testcase_11 AC 130 ms
4,352 KB
testcase_12 AC 75 ms
4,352 KB
testcase_13 AC 248 ms
24,672 KB
testcase_14 AC 254 ms
25,072 KB
testcase_15 AC 216 ms
19,512 KB
testcase_16 AC 217 ms
18,848 KB
testcase_17 AC 269 ms
25,876 KB
testcase_18 AC 234 ms
21,300 KB
testcase_19 AC 255 ms
24,304 KB
testcase_20 AC 222 ms
20,280 KB
testcase_21 AC 270 ms
24,124 KB
testcase_22 AC 258 ms
25,900 KB
testcase_23 AC 229 ms
20,316 KB
testcase_24 AC 255 ms
25,196 KB
testcase_25 AC 245 ms
23,312 KB
testcase_26 AC 271 ms
25,384 KB
testcase_27 AC 246 ms
21,248 KB
testcase_28 AC 286 ms
26,552 KB
testcase_29 AC 271 ms
26,564 KB
testcase_30 AC 273 ms
26,332 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 277 ms
26,392 KB
testcase_33 AC 266 ms
26,448 KB
testcase_34 AC 264 ms
26,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void){
    int N,Q;
    cin >> N >> Q;
    vector<long> dp(N+1);
    vector<long> sum(N+1);
    dp[1] = 1;
    for( int i = 1; i <= N; i++ ) {
        sum[i] = dp[i]+sum[i-1];
        for( int j = 2; i*j <= N; j++ ) {
            dp[i*j] += dp[i];
        }
    }
    for( int i = 0; i < Q; i++ ) {
        int x;
        cin >> x;
        printf("%ld\n",dp[x]*sum[N/x]);
    }
}
0