結果

問題 No.1232 2^x = x
ユーザー ninoinuininoinui
提出日時 2020-09-18 22:37:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 2,159 ms
コンパイル使用メモリ 200,052 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 11:13:50
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);

  for (auto p : P) {
    for (int i = 1; i <= 62; i++) {
      if ((1L << i) % p == i % p) {
        cout << i << "\n";
        goto NEXT;
      }
    }
    cout << -1 << "\n";
    NEXT:;
  }
}
0