結果
問題 |
No.673 カブトムシ
|
ユーザー |
|
提出日時 | 2025-08-11 19:47:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,202 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2025-08-11 19:47:32 |
合計ジャッジ時間 | 1,494 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 WA * 1 |
ソースコード
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()) if C == 1: ans = ModInt(B) * ModInt(D) elif D == 1: ans = ModInt(B) * ModInt(C) else: B, C = map(ModInt, (B, C)) 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()