結果

問題 No.129 お年玉(2)
ユーザー takubokudori
提出日時 2017-08-18 23:42:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 55,300 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-14 15:02:36
合計ジャッジ時間 3,592 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#define MAX 1000000000
using namespace std;

typedef long long ll;

int main(void){
	ll n,m;

	cin>>n>>m;
	if(n<1000){
		cout<<0<<endl;
		return 0;
	}
	n/=1000;
	n%=m; // mCn
	ll s1=1,s2=1; // s1/s2
	ll s[100001]={0};
	s[0]=1;
	s[1]=1;
	for(int i=2;i<=m;i++){
		s[i]=1;
		for(int j=1;j<i;j++){
			s[i-j]=s[i-j-1]+s[i-j];
			s[j]%=MAX;
		}
		s[0]=1;
		// for(int XX=0;XX<=n;XX++){
			// cout<<s[XX]<<" ";
		// }
		// cout<<endl;
	}
	cout<<s[n]%MAX<<endl;
	return 0;
}
0