結果

問題 No.1140 EXPotentiaLLL!
ユーザー Gosu_Hiroo
提出日時 2020-07-31 22:01:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 364 bytes
コンパイル時間 1,382 ms
コンパイル使用メモリ 168,240 KB
実行使用メモリ 17,096 KB
最終ジャッジ日時 2024-07-06 18:05:16
合計ジャッジ時間 8,484 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
int main() {
    int T;cin >> T;
    auto f = [&](ll x){
        if(x == 1)return 0;
        for(int i = 2;i*i<=x;i++)if(x%i==0)return 0;
        return 1;
    };
    while(T--){
        ll A, P;cin >> A >> P;
        if(f(P))cout << (!!(A%P)) << endl;
        else cout << -1 << endl;

    }

}
0