結果

問題 No.129 お年玉(2)
コンテスト
ユーザー amtgjw
提出日時 2018-05-23 17:13:40
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 714 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 687 ms
コンパイル使用メモリ 99,600 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-17 14:44:11
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 46
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <complex>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MOD			1000000000

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

int dp[MAX][MAX];

void pascal(int n){
	dp[1][1]=1;
	REPS(i,2,n+1){
		REP(j,n+1){
			dp[i][j] = (dp[i-1][j-1] + dp[i-1][j])%MOD;
		}
	}
}

int main(){
	ull N;cin>>N;
	int M;cin>>M;

	N /= 1000;

	int R = N%M;
	R = min(R,M-R);
	
	// M C R 
	pascal(M);
	cout << dp[M][R] << endl;

	return 0;
}
0