結果

問題 No.129 お年玉(2)
ユーザー nanophoto12nanophoto12
提出日時 2015-02-01 23:18:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,268 ms / 5,000 ms
コード長 1,045 bytes
コンパイル時間 3,252 ms
コンパイル使用メモリ 105,856 KB
実行使用メモリ 448,768 KB
最終ジャッジ日時 2024-04-21 09:49:19
合計ジャッジ時間 33,383 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
45,312 KB
testcase_01 AC 1,268 ms
448,768 KB
testcase_02 AC 26 ms
18,944 KB
testcase_03 AC 25 ms
18,816 KB
testcase_04 AC 23 ms
18,944 KB
testcase_05 AC 552 ms
201,728 KB
testcase_06 AC 820 ms
302,720 KB
testcase_07 AC 1,200 ms
364,160 KB
testcase_08 AC 688 ms
258,688 KB
testcase_09 AC 928 ms
337,792 KB
testcase_10 AC 1,045 ms
378,752 KB
testcase_11 AC 661 ms
248,320 KB
testcase_12 AC 867 ms
316,032 KB
testcase_13 AC 890 ms
328,704 KB
testcase_14 AC 859 ms
318,464 KB
testcase_15 AC 718 ms
267,520 KB
testcase_16 AC 815 ms
299,776 KB
testcase_17 AC 970 ms
357,632 KB
testcase_18 AC 915 ms
338,688 KB
testcase_19 AC 983 ms
359,552 KB
testcase_20 AC 961 ms
356,992 KB
testcase_21 AC 1,213 ms
438,528 KB
testcase_22 AC 719 ms
260,608 KB
testcase_23 AC 1,049 ms
386,688 KB
testcase_24 AC 998 ms
372,352 KB
testcase_25 AC 662 ms
249,600 KB
testcase_26 AC 682 ms
255,104 KB
testcase_27 AC 663 ms
248,192 KB
testcase_28 AC 1,227 ms
442,112 KB
testcase_29 AC 25 ms
19,200 KB
testcase_30 AC 25 ms
19,072 KB
testcase_31 AC 26 ms
19,072 KB
testcase_32 AC 24 ms
18,944 KB
testcase_33 AC 23 ms
18,944 KB
testcase_34 AC 27 ms
19,712 KB
testcase_35 AC 31 ms
22,144 KB
testcase_36 AC 32 ms
22,528 KB
testcase_37 AC 35 ms
23,680 KB
testcase_38 AC 186 ms
71,936 KB
testcase_39 AC 231 ms
98,048 KB
testcase_40 AC 611 ms
234,112 KB
testcase_41 AC 377 ms
152,448 KB
testcase_42 AC 177 ms
78,464 KB
testcase_43 AC 172 ms
77,568 KB
testcase_44 AC 1,230 ms
444,288 KB
testcase_45 AC 107 ms
52,992 KB
testcase_46 AC 257 ms
107,008 KB
testcase_47 AC 1,199 ms
430,592 KB
testcase_48 AC 750 ms
270,720 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.Generic;
using System.Linq;
using System.Text;

namespace YukiCoder2
{
    class Program
    {

        static void Main(string[] args)
        {
            ulong n = Console.ReadLine().Split(' ').Select(ulong.Parse).ToArray()[0];
            ulong m = Console.ReadLine().Split(' ').Select(ulong.Parse).ToArray()[0];
            ulong rest = (n /1000L) % m;
            if (rest == 0)
            {
                Console.WriteLine("1");
                return;
            }
            var buffer = new ulong[m+1,m+1];
            for (ulong i = 0; i < m+1; i++)
            {
                buffer[i, 0] = 1;
                buffer[i, i] = 1;
            }
            for (ulong i = 1; i < m+1; i++)
            {
                for (ulong k = 1; k < i; k++)
                {
                    buffer[i, k] = buffer[i - 1, k - 1] + buffer[i - 1, k];
                    buffer[i, k] %= 1000000000;
                }
            }
            Console.WriteLine(buffer[m,rest]);
        }
    }
}
0