結果

問題 No.129 お年玉(2)
ユーザー kuuso1kuuso1
提出日時 2015-01-16 23:47:09
言語 C#
(csc 3.9.0)
結果
AC  
実行時間 1,015 ms / 5,000 ms
コード長 1,231 bytes
コンパイル時間 3,213 ms
実行使用メモリ 31,516 KB
最終ジャッジ日時 2023-01-04 19:14:35
合計ジャッジ時間 33,974 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 266 ms
31,316 KB
testcase_01 AC 1,015 ms
31,416 KB
testcase_02 AC 53 ms
14,748 KB
testcase_03 AC 53 ms
14,788 KB
testcase_04 AC 54 ms
14,740 KB
testcase_05 AC 675 ms
31,416 KB
testcase_06 AC 817 ms
31,412 KB
testcase_07 AC 897 ms
31,352 KB
testcase_08 AC 751 ms
31,452 KB
testcase_09 AC 879 ms
31,432 KB
testcase_10 AC 918 ms
31,492 KB
testcase_11 AC 742 ms
31,372 KB
testcase_12 AC 839 ms
31,448 KB
testcase_13 AC 855 ms
31,380 KB
testcase_14 AC 852 ms
31,476 KB
testcase_15 AC 767 ms
31,396 KB
testcase_16 AC 819 ms
31,400 KB
testcase_17 AC 897 ms
31,424 KB
testcase_18 AC 882 ms
31,400 KB
testcase_19 AC 913 ms
31,516 KB
testcase_20 AC 907 ms
31,472 KB
testcase_21 AC 996 ms
31,444 KB
testcase_22 AC 753 ms
31,360 KB
testcase_23 AC 940 ms
31,356 KB
testcase_24 AC 918 ms
31,428 KB
testcase_25 AC 755 ms
31,412 KB
testcase_26 AC 751 ms
31,456 KB
testcase_27 AC 735 ms
31,392 KB
testcase_28 AC 994 ms
31,400 KB
testcase_29 AC 51 ms
14,780 KB
testcase_30 AC 51 ms
14,748 KB
testcase_31 AC 56 ms
16,292 KB
testcase_32 AC 57 ms
16,308 KB
testcase_33 AC 128 ms
31,136 KB
testcase_34 AC 94 ms
31,084 KB
testcase_35 AC 121 ms
30,984 KB
testcase_36 AC 127 ms
31,020 KB
testcase_37 AC 137 ms
31,316 KB
testcase_38 AC 365 ms
31,372 KB
testcase_39 AC 441 ms
31,396 KB
testcase_40 AC 719 ms
31,440 KB
testcase_41 AC 572 ms
31,392 KB
testcase_42 AC 389 ms
31,316 KB
testcase_43 AC 382 ms
31,284 KB
testcase_44 AC 1,000 ms
31,476 KB
testcase_45 AC 298 ms
31,352 KB
testcase_46 AC 470 ms
31,372 KB
testcase_47 AC 988 ms
31,412 KB
testcase_48 AC 776 ms
31,424 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		long rest=(N-N/M/1000*1000*M)/1000;
		if(rest>=M)rest=M;
		
		int[][] nCr=new int[2][];
		nCr[0]=new int[10001];
		nCr[0][0]=1;
		int now=1;int prev=0;
		int mod=(int)1e9;
		for(int i=1;i<=M;i++){
			now=i%2;
			prev=now^1;
			nCr[now]=new int[10001];
			nCr[now][0]=1;
			for(int j=1;j<=10000;j++){
				nCr[now][j]=(nCr[prev][j-1]+nCr[prev][j])%mod;
			}
		}
		Console.WriteLine(nCr[now][rest]);
		
		
		
		
		
	}
	long N,M;
	public Sol(){
		N=rl();M=rl();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0