結果
問題 | No.129 お年玉(2) |
ユーザー |
|
提出日時 | 2025-01-28 14:47:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 482 ms / 5,000 ms |
コード長 | 891 bytes |
コンパイル時間 | 3,461 ms |
コンパイル使用メモリ | 315,600 KB |
実行使用メモリ | 394,240 KB |
最終ジャッジ日時 | 2025-01-28 14:48:20 |
合計ジャッジ時間 | 15,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
typedef long long ll;typedef long double ld;#include <bits/stdc++.h>using namespace std;// #define int long long#include <ext/pb_ds/assoc_container.hpp>using namespace __gnu_pbds;template<typename T>using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;// std::cout << *s.find_by_order(1) << std::endl; // 2const ll MOD = 1000000000;signed main(){// これがないと落ちることがあるios_base::sync_with_stdio(false);cin.tie(0);ll n;cin >> n;ll m;cin >> m;n-=n%1000;n/=1000;vector<vector<int>> dp(m+1, vector<int>(m+1));dp[0][0]++;for (ll i = 0; i < m; i++){for (ll j = 0; j <= m; j++){dp[i+1][j] += dp[i][j];if(j-1>=0)dp[i+1][j] += dp[i][j-1];dp[i+1][j] %= MOD;}}cout << dp[m][n%m] << endl;}