結果

問題 No.1232 2^x = x
ユーザー ninoinui
提出日時 2020-09-18 22:37:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 2,009 ms
コンパイル使用メモリ 195,048 KB
最終ジャッジ日時 2025-01-14 17:35:34
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 3
権限があれば一括ダウンロードができます

ソースコード

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