結果
| 問題 | No.673 カブトムシ | 
| コンテスト | |
| ユーザー |  bluemegane | 
| 提出日時 | 2021-05-08 13:17:10 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,168 bytes | 
| コンパイル時間 | 996 ms | 
| コンパイル使用メモリ | 104,960 KB | 
| 実行使用メモリ | 18,560 KB | 
| 最終ジャッジ日時 | 2024-09-16 17:22:49 | 
| 合計ジャッジ時間 | 2,470 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 13 WA * 1 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Numerics;
using System;
public class Hello
{
    public static int MOD = 1000000007;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var b = long.Parse(line[0]);
        var c = long.Parse(line[1]);
        var d = long.Parse(line[2]);
        getAns(b, c, d);
    }
    static void getAns (long b, long c, long d)
    {
        if (c == 1)
        {
            BigInteger res0 = b % MOD;
            res0 *= d;
            res0 %= MOD;
            Console.WriteLine(res0);
            return;
        }
        if (d == 1)
        {
            BigInteger res0 = b % MOD;
            res0 *= c;
            res0 %= MOD;
            Console.WriteLine(res0);
            return;
        }
        BigInteger res = b % MOD;
        res *= c;
        res %= MOD;
        BigInteger t = BigInteger.ModPow(c, d, MOD) - 1;
        res *= t;
        res %= MOD;
        var t2 = ModInverse(c - 1, MOD);
        res *= t2;
        res %= MOD;
        Console.WriteLine(res);
    }
    public static BigInteger ModInverse(BigInteger a, BigInteger m)
    {
        return BigInteger.ModPow(a, m - 2, m);
    }
}
            
            
            
        