結果

問題 No.1791 Repeat Multiplication
ユーザー ytftytft
提出日時 2021-12-25 14:47:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 378 ms / 3,000 ms
コード長 458 bytes
コンパイル時間 1,760 ms
コンパイル使用メモリ 167,504 KB
実行使用メモリ 27,096 KB
最終ジャッジ日時 2023-10-21 15:54:22
合計ジャッジ時間 12,519 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 161 ms
5,152 KB
testcase_09 AC 144 ms
4,984 KB
testcase_10 AC 142 ms
4,964 KB
testcase_11 AC 130 ms
4,852 KB
testcase_12 AC 76 ms
4,372 KB
testcase_13 AC 345 ms
25,288 KB
testcase_14 AC 350 ms
25,792 KB
testcase_15 AC 275 ms
19,816 KB
testcase_16 AC 283 ms
19,432 KB
testcase_17 AC 364 ms
26,492 KB
testcase_18 AC 308 ms
22,056 KB
testcase_19 AC 352 ms
25,004 KB
testcase_20 AC 289 ms
20,564 KB
testcase_21 AC 343 ms
24,736 KB
testcase_22 AC 365 ms
26,600 KB
testcase_23 AC 293 ms
20,944 KB
testcase_24 AC 359 ms
25,632 KB
testcase_25 AC 344 ms
23,936 KB
testcase_26 AC 367 ms
26,064 KB
testcase_27 AC 305 ms
22,012 KB
testcase_28 AC 378 ms
27,084 KB
testcase_29 AC 362 ms
27,080 KB
testcase_30 AC 356 ms
27,092 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 358 ms
27,096 KB
testcase_33 AC 359 ms
27,096 KB
testcase_34 AC 369 ms
27,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,Q,x;
    cin>>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){
        cin>>x;
        cout<<(a[x-1]*b[x-1])<<endl;
    }
}
0