結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー mmn15277198mmn15277198
提出日時 2022-07-25 20:46:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 173,112 KB
実行使用メモリ 38,280 KB
最終ジャッジ日時 2023-09-22 06:39:29
合計ジャッジ時間 8,935 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 32 ms
7,428 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 8 ms
4,408 KB
testcase_05 AC 31 ms
7,264 KB
testcase_06 AC 435 ms
38,168 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 15 ms
5,304 KB
testcase_09 AC 15 ms
5,344 KB
testcase_10 AC 24 ms
6,600 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 423 ms
38,204 KB
testcase_13 AC 467 ms
38,092 KB
testcase_14 AC 184 ms
20,676 KB
testcase_15 AC 32 ms
7,300 KB
testcase_16 AC 25 ms
6,468 KB
testcase_17 AC 8 ms
4,380 KB
testcase_18 AC 459 ms
38,140 KB
testcase_19 AC 494 ms
38,280 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 15 ms
5,508 KB
testcase_22 AC 32 ms
7,260 KB
testcase_23 AC 16 ms
5,432 KB
testcase_24 WA -
testcase_25 AC 34 ms
7,472 KB
testcase_26 AC 195 ms
20,672 KB
testcase_27 AC 6 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 AC 12 ms
4,900 KB
testcase_31 AC 33 ms
7,328 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<long long> 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