結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-08-12 01:07:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 464 ms / 5,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 875 ms |
コンパイル使用メモリ | 85,140 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 00:07:36 |
合計ジャッジ時間 | 11,971 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <cstdio>#include <cstring>#include <cmath>#include <climits>#include <iostream>#include <iomanip>#include <list>#include <stack>#include <queue>#include <vector>#include <map>#include <set>#include <string>#include <utility>#include <algorithm>#include <numeric>#include <functional>#define FOR(i,a,b) for (int i=(a);i<(b);i++)#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)#define REP(i,n) for (int i=0;i<(n);i++)#define RREP(i,n) for (int i=(n)-1;i>=0;i--)#define ALL(a) (a).begin(),(a).end()using namespace std;typedef long long ll;ll N, M;ll dp[2][10010];ll P = 1000000000;int main(int argc, char *argv[]){cin.tie(0);ios::sync_with_stdio(false);cin >> N >> M;N /= 1000;N %= M;dp[0][0] = dp[1][0] = 1;FOR(i,1,M+1) FOR(j,1,i+1) dp[i&1][j] = (dp[(i-1)&1][j-1] + dp[(i-1)&1][j]) % P;cout << dp[M&1][N] << endl;return 0;}