結果

問題 No.1232 2^x = x
ユーザー YamaKasaYamaKasa
提出日時 2020-09-18 22:42:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 163,484 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 11:18:26
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge14 / 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;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll p[N];
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }
    ll v = 2;
    ll t = pow(10, 18);
    for (int i = 0; i < N; i++) {
        v = 4;
        bool flag = true;
        for (int x = 2; x < 60; x++) {
            if (v > t) break;
            if ((v % p[i]) == (x % p[i])) {
                flag = false;
                cout << x << "\n";
                break;
            }
            v *= 2;
        }
        if (flag) {
            cout << "-1\n";
        }
    }
    return 0;
}
0