結果

問題 No.129 お年玉(2)
ユーザー ebicochineal
提出日時 2017-04-05 01:31:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 22,400 KB
最終ジャッジ日時 2024-11-28 00:47:41
合計ジャッジ時間 3,796 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;

public class Program {
    static BigInteger ncm(long n, long m) {
        BigInteger r = 1;
        for (long i = 1; i < m+1; ++i, --n) {
            r *= n;
            r /= i;
        }
        return r;
    }
    
    static void Main(string[] args) {
        long N = long.Parse(Console.ReadLine());
        long M = long.Parse(Console.ReadLine());
        long m = (N % (M * 1000)) / 1000;
        Console.WriteLine(ncm(M, m) % 1000000000);
    }
}
0