結果

問題 No.129 お年玉(2)
ユーザー 👑 kmjpkmjp
提出日時 2017-08-16 19:18:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 194 ms / 5,000 ms
コード長 845 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 145,492 KB
実行使用メモリ 390,540 KB
最終ジャッジ日時 2023-08-18 18:02:53
合計ジャッジ時間 12,614 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
388,364 KB
testcase_01 AC 192 ms
388,528 KB
testcase_02 AC 194 ms
388,248 KB
testcase_03 AC 192 ms
388,364 KB
testcase_04 AC 194 ms
388,528 KB
testcase_05 AC 188 ms
390,536 KB
testcase_06 AC 189 ms
390,524 KB
testcase_07 AC 188 ms
390,524 KB
testcase_08 AC 189 ms
390,476 KB
testcase_09 AC 193 ms
390,304 KB
testcase_10 AC 187 ms
390,296 KB
testcase_11 AC 188 ms
390,300 KB
testcase_12 AC 190 ms
390,292 KB
testcase_13 AC 189 ms
390,248 KB
testcase_14 AC 189 ms
390,256 KB
testcase_15 AC 188 ms
390,364 KB
testcase_16 AC 189 ms
390,400 KB
testcase_17 AC 187 ms
390,304 KB
testcase_18 AC 188 ms
390,308 KB
testcase_19 AC 189 ms
390,244 KB
testcase_20 AC 190 ms
390,304 KB
testcase_21 AC 188 ms
390,264 KB
testcase_22 AC 190 ms
390,248 KB
testcase_23 AC 189 ms
390,308 KB
testcase_24 AC 189 ms
390,504 KB
testcase_25 AC 189 ms
390,540 KB
testcase_26 AC 189 ms
390,332 KB
testcase_27 AC 190 ms
390,308 KB
testcase_28 AC 191 ms
390,292 KB
testcase_29 AC 190 ms
390,524 KB
testcase_30 AC 190 ms
390,296 KB
testcase_31 AC 189 ms
390,524 KB
testcase_32 AC 188 ms
390,304 KB
testcase_33 AC 187 ms
390,364 KB
testcase_34 AC 189 ms
390,400 KB
testcase_35 AC 189 ms
390,248 KB
testcase_36 AC 188 ms
390,372 KB
testcase_37 AC 190 ms
390,408 KB
testcase_38 AC 190 ms
390,340 KB
testcase_39 AC 189 ms
390,404 KB
testcase_40 AC 190 ms
390,524 KB
testcase_41 AC 189 ms
390,256 KB
testcase_42 AC 189 ms
390,256 KB
testcase_43 AC 190 ms
390,368 KB
testcase_44 AC 188 ms
390,244 KB
testcase_45 AC 188 ms
390,308 KB
testcase_46 AC 188 ms
390,244 KB
testcase_47 AC 188 ms
390,532 KB
testcase_48 AC 189 ms
390,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,M;
int C[10001][10001];
void solve() {
	int i,j,k,l,r,x,y; string s;
	cin>>N>>M;
	N/=1000;
	ll R=N%M;
	
	FOR(i,10001) {
		C[i][i]=C[i][0]=1;
		for(j=1;j<i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%1000000000;
	}
	cout<<C[M][R]<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0