結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー mmn15277198mmn15277198
提出日時 2022-07-25 20:45:17
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 2,553 ms
コンパイル使用メモリ 171,904 KB
実行使用メモリ 36,296 KB
最終ジャッジ日時 2023-09-22 06:37:46
合計ジャッジ時間 12,253 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 37 ms
7,236 KB
testcase_02 AC 5 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 8 ms
4,600 KB
testcase_05 AC 34 ms
7,256 KB
testcase_06 AC 581 ms
36,056 KB
testcase_07 AC 2 ms
4,500 KB
testcase_08 AC 16 ms
5,400 KB
testcase_09 AC 16 ms
5,384 KB
testcase_10 AC 27 ms
6,608 KB
testcase_11 AC 8 ms
4,472 KB
testcase_12 AC 560 ms
36,168 KB
testcase_13 AC 648 ms
36,100 KB
testcase_14 AC 256 ms
19,668 KB
testcase_15 AC 37 ms
7,408 KB
testcase_16 AC 26 ms
6,476 KB
testcase_17 AC 8 ms
4,452 KB
testcase_18 AC 630 ms
36,296 KB
testcase_19 AC 653 ms
36,272 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 15 ms
5,448 KB
testcase_22 AC 36 ms
7,460 KB
testcase_23 AC 16 ms
5,332 KB
testcase_24 WA -
testcase_25 AC 39 ms
7,332 KB
testcase_26 AC 241 ms
19,812 KB
testcase_27 AC 6 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 WA -
testcase_30 AC 13 ms
5,048 KB
testcase_31 AC 34 ms
7,284 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, n;
  cin >> a >> n;
  long long m = 1e7;
  cout << m << endl;
  map<long long, int> mp;
  vector<int> cnt;
  long long x = 1;
  for (int i = 1; i <= m; i++) {
    x = x % m * a % m;
    if (mp[x] != 0) {
      break;
    } else {
      mp[x]++;
      cnt.push_back(x);
    }
  }
  cout << cnt[n % ((long long) cnt.size()) - 1] << endl;
  return 0;
}
0