結果
| 問題 |
No.181 A↑↑N mod M
|
| コンテスト | |
| ユーザー |
古寺いろは
|
| 提出日時 | 2015-04-06 00:02:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 364 bytes |
| コンパイル時間 | 1,352 ms |
| コンパイル使用メモリ | 160,448 KB |
| 実行使用メモリ | 813,944 KB |
| 最終ジャッジ日時 | 2024-07-04 02:17:15 |
| 合計ジャッジ時間 | 4,769 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | MLE * 1 -- * 36 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int dfs(int A, int N, int M){
if (N == 0) return 1;
if (M <= 1) return 0;
vector<int> v;
long long temp = 1;
do{
v.push_back((int)temp);
temp *= A;
temp %= M;
} while (temp != 1);
return v[dfs(A, N - 1, v.size()) % M];
}
int main() {
int A, N, M;
cin >> A >> N >> M;
cout << dfs(A, N, M) << endl;
}
古寺いろは