結果

問題 No.1581 Multiple Sequence
ユーザー ace_amuroace_amuro
提出日時 2023-03-28 17:02:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 81,280 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 11:06:44
合計ジャッジ時間 2,164 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 4 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 3 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 5 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 5 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 4 ms
4,348 KB
testcase_20 AC 5 ms
4,348 KB
testcase_21 AC 5 ms
4,348 KB
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 5 ms
4,348 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=1e6+10;
const int MOD=1e9+7;
int x[MR];
int main(){
    int M;
    cin>>M;
    x[0]=1;
    /*
    for(int k=1;k<=M;k++){
        for(int i=1;i*i<=k;i++){
            if(k%i!=0) continue;
            x[k]+=x[k/i-1];
            x[k]%=MOD;
            if(i*i<k) x[k]+=x[i-1];
            x[k]%=MOD;
        }
    }
    */
    for(int i=1;i<=M;i++){
        for(int k=i;k<=M;k+=i){
            x[k]+=x[i-1];
            x[k]%=MOD;
        }
    }
    cout<<x[M]<<endl;
    return 0;
}
0