結果

問題 No.251 大きな桁の復習問題(1)
ユーザー nebukuro09nebukuro09
提出日時 2016-10-16 14:19:20
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-05-02 02:20:41
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 12 ms
6,272 KB
testcase_03 WA -
testcase_04 AC 12 ms
6,400 KB
testcase_05 AC 12 ms
6,272 KB
testcase_06 AC 11 ms
6,144 KB
testcase_07 AC 11 ms
6,144 KB
testcase_08 AC 11 ms
6,144 KB
testcase_09 AC 146 ms
6,656 KB
testcase_10 AC 150 ms
6,784 KB
testcase_11 AC 145 ms
6,784 KB
testcase_12 AC 146 ms
6,656 KB
testcase_13 AC 146 ms
6,656 KB
testcase_14 AC 145 ms
6,656 KB
testcase_15 AC 145 ms
6,784 KB
testcase_16 AC 146 ms
6,656 KB
testcase_17 AC 145 ms
6,784 KB
testcase_18 AC 146 ms
6,784 KB
testcase_19 AC 146 ms
6,656 KB
testcase_20 AC 11 ms
6,272 KB
testcase_21 AC 11 ms
6,016 KB
testcase_22 AC 11 ms
6,016 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def powermod(n, x, mod):
    if x == 0:
        return n % mod
    elif n == 0:
        return 0

    ans = 1
    while x >= 1:
        if x%2:
            ans = ans * n % mod
        n = n * n % mod
        x /= 2
    return ans

MOD = 129402307
print powermod(int(raw_input()), int(raw_input())%(MOD-1), MOD)
0