結果

問題 No.129 お年玉(2)
ユーザー kuuso1kuuso1
提出日時 2015-01-16 23:47:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,118 ms / 5,000 ms
コード長 1,231 bytes
コンパイル時間 3,464 ms
コンパイル使用メモリ 102,972 KB
実行使用メモリ 41,724 KB
最終ジャッジ日時 2023-08-18 16:27:16
合計ジャッジ時間 35,559 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 250 ms
41,440 KB
testcase_01 AC 957 ms
39,536 KB
testcase_02 AC 48 ms
20,624 KB
testcase_03 AC 51 ms
20,848 KB
testcase_04 AC 48 ms
20,736 KB
testcase_05 AC 637 ms
41,520 KB
testcase_06 AC 772 ms
39,488 KB
testcase_07 AC 890 ms
39,520 KB
testcase_08 AC 743 ms
39,488 KB
testcase_09 AC 870 ms
41,488 KB
testcase_10 AC 951 ms
39,480 KB
testcase_11 AC 753 ms
39,516 KB
testcase_12 AC 872 ms
37,352 KB
testcase_13 AC 891 ms
39,664 KB
testcase_14 AC 867 ms
41,504 KB
testcase_15 AC 781 ms
41,488 KB
testcase_16 AC 828 ms
39,648 KB
testcase_17 AC 907 ms
39,576 KB
testcase_18 AC 894 ms
39,488 KB
testcase_19 AC 926 ms
39,512 KB
testcase_20 AC 936 ms
41,536 KB
testcase_21 AC 1,036 ms
41,540 KB
testcase_22 AC 789 ms
41,464 KB
testcase_23 AC 977 ms
41,520 KB
testcase_24 AC 954 ms
39,440 KB
testcase_25 AC 755 ms
41,668 KB
testcase_26 AC 750 ms
41,596 KB
testcase_27 AC 747 ms
41,528 KB
testcase_28 AC 1,118 ms
39,572 KB
testcase_29 AC 58 ms
20,692 KB
testcase_30 AC 60 ms
22,740 KB
testcase_31 AC 65 ms
22,324 KB
testcase_32 AC 65 ms
22,344 KB
testcase_33 AC 142 ms
39,056 KB
testcase_34 AC 107 ms
41,184 KB
testcase_35 AC 136 ms
39,096 KB
testcase_36 AC 146 ms
41,192 KB
testcase_37 AC 159 ms
41,376 KB
testcase_38 AC 407 ms
39,272 KB
testcase_39 AC 494 ms
41,372 KB
testcase_40 AC 689 ms
41,520 KB
testcase_41 AC 546 ms
41,476 KB
testcase_42 AC 366 ms
41,460 KB
testcase_43 AC 372 ms
41,464 KB
testcase_44 AC 982 ms
41,564 KB
testcase_45 AC 287 ms
41,384 KB
testcase_46 AC 438 ms
41,464 KB
testcase_47 AC 970 ms
41,724 KB
testcase_48 AC 752 ms
39,468 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