結果

問題 No.129 お年玉(2)
ユーザー nanophoto12
提出日時 2015-02-01 23:01:42
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 997 bytes
コンパイル時間 3,664 ms
コンパイル使用メモリ 105,216 KB
実行使用メモリ 469,400 KB
最終ジャッジ日時 2024-06-23 05:27:23
合計ジャッジ時間 22,482 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
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];
                }
            }
            Console.WriteLine(buffer[m,rest]);
        }
    }
}
0