結果

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

ソースコード

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;
	ll s1=1,s2=1; // s1/s2
	for(int i=1;i<=n;i++){
		if(m-i+1>0) s1*=m-i+1;
		s1%=MAX;
		s2*=i;
		s2%=MAX;
	}
	cout<<(s1/s2)%MAX<<endl;
	return 0;
}
0