結果

問題 No.1791 Repeat Multiplication
ユーザー ytftytft
提出日時 2021-12-25 14:48:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 185 ms / 3,000 ms
コード長 478 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 167,128 KB
実行使用メモリ 27,240 KB
最終ジャッジ日時 2023-10-21 15:55:24
合計ジャッジ時間 7,076 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 23 ms
5,296 KB
testcase_09 AC 21 ms
5,128 KB
testcase_10 AC 20 ms
5,108 KB
testcase_11 AC 19 ms
4,996 KB
testcase_12 AC 12 ms
4,516 KB
testcase_13 AC 166 ms
25,432 KB
testcase_14 AC 171 ms
25,936 KB
testcase_15 AC 114 ms
19,960 KB
testcase_16 AC 116 ms
19,576 KB
testcase_17 AC 175 ms
26,636 KB
testcase_18 AC 140 ms
22,200 KB
testcase_19 AC 168 ms
25,148 KB
testcase_20 AC 124 ms
20,708 KB
testcase_21 AC 161 ms
24,880 KB
testcase_22 AC 176 ms
26,748 KB
testcase_23 AC 129 ms
21,088 KB
testcase_24 AC 170 ms
25,776 KB
testcase_25 AC 154 ms
24,080 KB
testcase_26 AC 173 ms
26,208 KB
testcase_27 AC 137 ms
22,156 KB
testcase_28 AC 183 ms
27,228 KB
testcase_29 AC 185 ms
27,224 KB
testcase_30 AC 182 ms
27,236 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 184 ms
27,240 KB
testcase_33 AC 183 ms
27,240 KB
testcase_34 AC 182 ms
27,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,Q,x;
    scanf("%d%d",&N,&Q);
    long long a[N],b[N];
    for(int i=N-1;i>=0;--i){
        a[i]=1;
        for(int j=i*2+1;j<N;j+=i+1){
            a[i]+=a[j];
        }
    }
    fill(b+1,b+N,0);
    b[0]=1;
    for(int i=0;i<N;++i){
        for(int j=i*2+1;j<N;j+=i+1){
            b[j]+=b[i];
        }
    }
    for(int i=0;i<Q;++i){
        scanf("%d",&x);
        printf("%ld\n",a[x-1]*b[x-1]);
    }
}
0