結果

問題 No.1232 2^x = x
ユーザー iqueue02iqueue02
提出日時 2020-09-18 23:22:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 515 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 196,872 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-04 11:36:30
合計ジャッジ時間 5,677 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,756 KB
testcase_01 AC 45 ms
4,380 KB
testcase_02 TLE -
testcase_03 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

void solve (int p) {
  int cur = 2 % p;
  int cnt = 1;
  int res = -1;
  while (res == -1) {
    if (cur == cnt % p) res = cnt;
    cur *= 2;
    cur %= p;
    cnt++;
  }
  //cout << "ans ";
  cout << res << endl;
}

int main() {
  int n;
  cin >> n;
  while (n--) {
    int p;
    cin >> p;
    solve(p);
  }
  return 0; 
}
0