結果

問題 No.1140 EXPotentiaLLL!
ユーザー shiomusubi496shiomusubi496
提出日時 2020-07-31 22:30:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,109 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 1,430 ms
コンパイル使用メモリ 169,956 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 19:38:41
合計ジャッジ時間 11,719 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    vector<bool> A(10000000,true);
    A[0]=false,A[1]=false;
    for(int i=2;i<=10000000/i;i++){
        if(!A[i])continue;
        for(int j=i*2;j<10000000;j+=i)A[j]=false;
    }
    int T;
    cin>>T;
    while(T--){
        int a,P;
        cin>>a>>P;
        if(!A[P])puts("-1");
        else if(a%P==0)puts("0");
        else puts("1");
    }
}
0