結果

問題 No.1232 2^x = x
コンテスト
ユーザー kyoprouno
提出日時 2020-09-18 22:04:04
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 856 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,987 ms
コンパイル使用メモリ 192,712 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-06 14:31:15
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

const ll INF=1e18;


int main(){
    ll n;
    cin >> n;
    rep(i,n){
        ll p;
        cin >> p;
        ll val=2;
        ll x=1;
        ll ans=-1;
        while(val<=INF){
            if(val%p==x%p){
                ans=x;
                break;
            }
            val*=2;
            x++;
        }
        cout << ans << endl;
    }
    return 0;
}
0