結果

問題 No.129 お年玉(2)
ユーザー dnish
提出日時 2017-07-10 00:27:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 325 bytes
コンパイル時間 1,625 ms
コンパイル使用メモリ 166,140 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-07 05:03:23
合計ジャッジ時間 3,076 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(ll i=(n);i<(ll) N;i++)
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const ll mod=1e9;

int main(){
	ll n,m;
	cin>>n>>m;
	ll dist=n/1000/m;
	ll r=n-dist*1000*m;
	r/=1000;
	ll ans=1;
	REP(i,1,r+1){
		ans*=(m-i+1);
		ans/=i;
	}
	p(ans%mod);
	return 0;
}
0