結果

問題 No.523 LED
ユーザー mban
提出日時 2017-06-03 14:12:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 110,732 KB
実行使用メモリ 26,184 KB
最終ジャッジ日時 2024-09-22 04:29:36
合計ジャッジ時間 3,898 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N;
    private const int Mod = 1000000007;

    private long Pow(long a,long b,int mod)
    {
        long res = 1;
        while (b > 0)
        {
            if(b%2 == 1)
            {
                res *= a;
                res %= mod;
            }
            a *= a;
            a %= mod;
            b /= 2;
        }
        return res;
    }

    public void Solve()
    {
        N = int.Parse(Console.ReadLine());
        long ans = 1;
        for(int i = 1; i <= N * 2; i++)
        {
            ans *= i;
            ans %= Mod;
        }
        long a = Pow(2, N,Mod);
        long b = Pow(a, Mod - 2, Mod);
        ans *= b;
        ans %= Mod;
        Console.WriteLine(ans);
    }
}

0