結果

問題 No.1791 Repeat Multiplication
ユーザー ytftytft
提出日時 2021-12-25 14:45:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 1,627 ms
コンパイル使用メモリ 167,512 KB
実行使用メモリ 15,404 KB
最終ジャッジ日時 2023-10-21 15:52:42
合計ジャッジ時間 11,163 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 157 ms
4,416 KB
testcase_09 AC 139 ms
4,348 KB
testcase_10 AC 138 ms
4,348 KB
testcase_11 AC 127 ms
4,348 KB
testcase_12 AC 76 ms
4,348 KB
testcase_13 AC 260 ms
14,484 KB
testcase_14 AC 262 ms
14,736 KB
testcase_15 AC 237 ms
11,748 KB
testcase_16 AC 234 ms
11,556 KB
testcase_17 AC 267 ms
15,088 KB
testcase_18 AC 247 ms
12,868 KB
testcase_19 AC 257 ms
14,344 KB
testcase_20 AC 237 ms
12,124 KB
testcase_21 AC 256 ms
14,208 KB
testcase_22 AC 266 ms
15,140 KB
testcase_23 WA -
testcase_24 AC 265 ms
14,656 KB
testcase_25 AC 254 ms
13,808 KB
testcase_26 AC 263 ms
14,872 KB
testcase_27 AC 244 ms
12,848 KB
testcase_28 WA -
testcase_29 AC 269 ms
15,380 KB
testcase_30 AC 271 ms
15,384 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 WA -
testcase_33 AC 272 ms
15,388 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,Q,x;
    cin>>N>>Q;
    int 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