結果

問題 No.129 お年玉(2)
ユーザー 沙耶花沙耶花
提出日時 2021-10-26 23:55:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 534 bytes
コンパイル時間 3,857 ms
コンパイル使用メモリ 251,348 KB
最終ジャッジ日時 2025-01-25 07:33:41
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000


int main(){
	
	long long n,m;
	cin>>n>>m;
	
	n /= 1000;
	
	int ans = n%m;
	
	vector<int> dp(1,1);
	
	rep(i,m){
		vector<int> ndp(dp.size()+1,0);
		rep(j,dp.size()){
			ndp[j] += dp[j];
			ndp[j] %= 1000000000;
			ndp[j+1] += dp[j];
			ndp[j+1] %= 1000000000;
		}
		swap(dp,ndp);
	}
	cout<<dp[ans]<<endl;
	
	return 0;
}
0