結果

問題 No.2007 Arbitrary Mod (Easy)
コンテスト
ユーザー ThinkingStone
提出日時 2022-07-15 21:40:11
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 366 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2026-03-15 18:43:02
合計ジャッジ時間 3,124 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# import numpy as np
# import decimal
# decimal.getcontext().prec = 100000
# a, n = map(decimal.Decimal, input().split())
# # m = 10 ** 7
# m = 998244353
# print(m)
# q, r = np.divmod(np.power(a,n), m)
# print(r)

m = 1000000007
# m = 998244353
def modpow(a,n,mod):
    res = 1
    while n > 0:
        if n & 1:
            res = int(res * a % mod)
        a = int(a * a % mod) 
        n = n >> 1
    return res

a, n = map(int, input().split())
print(m)
print(modpow(a, n, m))
0