結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2016-02-12 01:48:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 217 ms / 1,000 ms |
| コード長 | 290 bytes |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-22 01:27:53 |
| 合計ジャッジ時間 | 2,907 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
from decimal import Decimal, getcontext
def solve():
N = input()
M = input()
n = Decimal(N[-1])
m = Decimal(M)
if m == 0:
print(1)
return
ctx = getcontext()
ans = ctx.power(n, m, 10)
print(ans)
if __name__ == '__main__':
solve()
しらっ亭