結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー mmn15277198mmn15277198
提出日時 2022-07-25 20:43:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 172,256 KB
実行使用メモリ 28,500 KB
最終ジャッジ日時 2023-09-22 06:35:01
合計ジャッジ時間 11,422 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 32 ms
6,488 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 8 ms
4,380 KB
testcase_05 AC 32 ms
6,392 KB
testcase_06 AC 505 ms
28,360 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 14 ms
4,776 KB
testcase_09 AC 15 ms
5,060 KB
testcase_10 AC 25 ms
5,776 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 495 ms
28,496 KB
testcase_13 AC 557 ms
28,356 KB
testcase_14 AC 218 ms
15,776 KB
testcase_15 AC 32 ms
6,276 KB
testcase_16 AC 25 ms
5,676 KB
testcase_17 AC 8 ms
4,380 KB
testcase_18 AC 566 ms
28,432 KB
testcase_19 AC 566 ms
28,500 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 14 ms
4,792 KB
testcase_22 AC 32 ms
6,232 KB
testcase_23 AC 15 ms
4,764 KB
testcase_24 WA -
testcase_25 AC 32 ms
6,276 KB
testcase_26 AC 220 ms
15,724 KB
testcase_27 AC 6 ms
4,380 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 WA -
testcase_30 AC 11 ms
4,556 KB
testcase_31 AC 32 ms
6,360 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  long long n;
  cin >> a >> n;
  int m = 1e7;
  cout << m << endl;
  map<int, 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 % (cnt.size()) - 1] << endl;
  return 0;
}
0