結果
| 問題 |
No.673 カブトムシ
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-05-08 13:10:34 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 984 bytes |
| コンパイル時間 | 918 ms |
| コンパイル使用メモリ | 114,648 KB |
| 実行使用メモリ | 26,844 KB |
| 最終ジャッジ日時 | 2024-09-16 17:15:38 |
| 合計ジャッジ時間 | 2,442 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 2 |
コンパイルメッセージ
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;
}
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);
}
}
bluemegane