結果
問題 | No.1581 Multiple Sequence |
ユーザー |
![]() |
提出日時 | 2023-09-01 09:43:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 750 bytes |
コンパイル時間 | 9,047 ms |
コンパイル使用メモリ | 332,004 KB |
実行使用メモリ | 8,220 KB |
最終ジャッジ日時 | 2025-01-03 06:25:52 |
合計ジャッジ時間 | 7,705 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using mint=modint1000000007;using ll=long long;using pp=pair<int,int>;#define sr string#define vc vector#define fi first#define se second#define rep(i,n) for(int i=0;i<(int)n;i++)#define pb push_back#define all(v) v.begin(),v.end()#define pque priority_queue#define bpc(a) __builtin_popcount(a)int main(){// r=kx (k+1)x=mint m;cin>>m;vc<mint>dp(m+1,-1);auto f=[&](auto f,int rest)->mint{if(rest==0)return 1;if(dp[rest]!=-1)return dp[rest];mint res=0;for(int i=1;i*i<=rest;i++)if(rest%i==0){res+=f(f,rest/i-1);if(i!=rest/i)res+=f(f,i-1);}return dp[rest]=res;};cout<<f(f,m).val();}