結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-01-16 23:47:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 939 ms / 5,000 ms |
コード長 | 1,231 bytes |
コンパイル時間 | 4,449 ms |
コンパイル使用メモリ | 105,600 KB |
実行使用メモリ | 34,188 KB |
最終ジャッジ日時 | 2024-11-27 22:58:54 |
合計ジャッジ時間 | 31,884 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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));} }