Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- const int MX = 1e3 +50;
- #define ll long long
- const ll mod = 1e9 ;
- ll dp[MX];
- int n;
- int main(){
- cin >> n;
- dp[0] = 1;
- for(int j = 1; j<n; j++){
- for(int i = n; i>=1; i--){
- if(i - j < 0) continue ;
- dp[i] += dp[i - j];
- if(dp[i] > mod) dp[i] -= mod;
- }
- }
- cout << dp[n] << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement