結果
問題 | No.181 A↑↑N mod M |
ユーザー | btk |
提出日時 | 2015-07-06 11:30:13 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 330 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 10,688 KB |
実行使用メモリ | 20,872 KB |
最終ジャッジ日時 | 2023-09-22 09:05:50 |
合計ジャッジ時間 | 9,366 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 114 ms
20,532 KB |
testcase_01 | AC | 116 ms
20,436 KB |
testcase_02 | AC | 115 ms
20,552 KB |
testcase_03 | AC | 112 ms
20,652 KB |
testcase_04 | AC | 112 ms
20,300 KB |
testcase_05 | AC | 115 ms
20,656 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 118 ms
20,368 KB |
testcase_10 | WA | - |
testcase_11 | AC | 114 ms
20,584 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 113 ms
20,372 KB |
testcase_19 | AC | 110 ms
20,376 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 110 ms
20,544 KB |
testcase_23 | WA | - |
testcase_24 | AC | 112 ms
20,552 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 112 ms
20,556 KB |
testcase_28 | WA | - |
testcase_29 | AC | 111 ms
20,612 KB |
testcase_30 | AC | 111 ms
20,616 KB |
testcase_31 | WA | - |
testcase_32 | AC | 112 ms
20,580 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 113 ms
20,652 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
ソースコード
from pip._vendor.distlib.compat import raw_input A, N, M=map(int,raw_input().split()) memo={1:0} res={0:1} p=1 while pow(A,p,M) not in memo: tmp=pow(A,p,M) memo[tmp]=memo[p]+1 res[memo[tmp]]=tmp p=tmp d=memo[p]+1-memo[pow(A,p,M)] s=memo[pow(A,p,M)] if s>=N: print(res[N]) else : print(res[((N-s)%d+s)])