結果
問題 |
No.673 カブトムシ
|
ユーザー |
|
提出日時 | 2025-08-11 19:28:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,137 bytes |
コンパイル時間 | 447 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2025-08-11 19:28:24 |
合計ジャッジ時間 | 1,862 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 10 WA * 4 |
ソースコード
import sys MOD = 1000000007 class ModInt: def __init__(self, x): self.x = x % MOD def __str__(self): return str(self.x) __repr__ = __str__ def __add__(self, other): if isinstance(other, ModInt): return ModInt(self.x + other.x) else: return ModInt(self.x + other) def __sub__(self, other): if isinstance(other, ModInt): return ModInt(self.x - other.x) else: return ModInt(self.x - other) def __mul__(self, other): if isinstance(other, ModInt): return ModInt(self.x * other.x) else: return ModInt(self.x * other) def __truediv__(self, other): if isinstance(other, ModInt): return ModInt(self.x * pow(other.x, MOD - 2, MOD)) else: return ModInt(self.x * pow(other, MOD - 2, MOD)) def __pow__(self, other): if isinstance(other, ModInt): return ModInt(pow(self.x, other.x, MOD)) else: return ModInt(pow(self.x, other, MOD)) __radd__ = __add__ def __rsub__(self, other): if isinstance(other, ModInt): return ModInt(other.x - self.x) else: return ModInt(other - self.x) __rmul__ = __mul__ def __rtruediv__(self, other): if isinstance(other, ModInt): return ModInt(other.x * pow(self.x, MOD - 2, MOD)) else: return ModInt(other * pow(self.x, MOD - 2, MOD)) def __rpow__(self, other): if isinstance(other, ModInt): return ModInt(pow(other.x, self.x, MOD)) else: return ModInt(pow(other, self.x, MOD)) def main(): # sys.setrecursionlimit(100000) input = lambda: sys.stdin.readline()[:-1] B, C, D = map(int, input().split()) B, C = map(ModInt, (B, C)) if C == 1: ans = B * ModInt(D) else: ans = B * ((C**D) - 1) / (C - 1) * C print(ans) if not __debug__: f = open(sys.argv[1], "r") sys.stdin = f # try: # sys.set_int_max_str_digits(100000) # except AttributeError: # pass main()