結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2018-06-22 17:50:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 336 ms / 5,000 ms |
| コード長 | 753 bytes |
| コンパイル時間 | 1,572 ms |
| コンパイル使用メモリ | 166,420 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 01:05:08 |
| 合計ジャッジ時間 | 7,494 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod= 1e9;
ll dp[2][10100];
int main(){
ll N, M;
cin >> N >> M;
N /= 1000;
N %= M;
dp[0][0]=1;
int from = 0;
int to = 1;
REP(i,0,M){
REP(j,0,N+1){
(dp[to][j] += dp[from][j]) %= mod;
if(j+1<=N) (dp[to][j+1] += dp[from][j]) %= mod;
}
swap(from, to);
REP(j,0,N+1) dp[to][j] = 0;
}
p(dp[from][N]);
return 0;
}
dnish