結果

問題 No.1518 Simple Combinatorics
ユーザー bluemeganebluemegane
提出日時 2021-05-29 07:38:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 104,448 KB
実行使用メモリ 26,580 KB
最終ジャッジ日時 2024-04-25 07:39:34
合計ジャッジ時間 2,371 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
26,444 KB
testcase_01 AC 34 ms
22,448 KB
testcase_02 AC 31 ms
26,580 KB
testcase_03 AC 32 ms
24,800 KB
testcase_04 AC 31 ms
24,796 KB
testcase_05 AC 31 ms
24,664 KB
testcase_06 AC 32 ms
24,672 KB
testcase_07 AC 32 ms
24,416 KB
testcase_08 AC 32 ms
24,416 KB
testcase_09 AC 32 ms
22,712 KB
testcase_10 AC 33 ms
26,572 KB
testcase_11 AC 34 ms
24,496 KB
testcase_12 AC 32 ms
22,448 KB
testcase_13 AC 31 ms
24,540 KB
testcase_14 AC 33 ms
24,544 KB
testcase_15 AC 31 ms
24,796 KB
testcase_16 AC 34 ms
24,644 KB
testcase_17 AC 31 ms
24,648 KB
testcase_18 AC 32 ms
24,672 KB
testcase_19 AC 32 ms
26,580 KB
testcase_20 AC 31 ms
24,800 KB
testcase_21 AC 34 ms
24,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Numerics;
using System;

public class Hello
{
    public static int MOD = 1000000007;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = long.Parse(line[0]);
        var k = long.Parse(line[1]);
        getAns(n, k);
    }
    static void getAns(long n, long k)
    {
        var ans = BigInteger.ModPow(n, k, MOD) - BigInteger.ModPow(n - 1, k, MOD);
        if (ans < 0) ans += MOD;
        ans *= n;
        ans %= MOD;
        Console.WriteLine(ans);
    }
}
0