結果

問題 No.1140 EXPotentiaLLL!
ユーザー shiomusubi496shiomusubi496
提出日時 2020-07-31 22:30:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,189 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 166,620 KB
実行使用メモリ 4,432 KB
最終ジャッジ日時 2023-09-21 00:55:22
合計ジャッジ時間 12,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,173 ms
4,380 KB
testcase_01 AC 1,189 ms
4,380 KB
testcase_02 AC 1,171 ms
4,376 KB
testcase_03 AC 846 ms
4,380 KB
testcase_04 AC 657 ms
4,404 KB
testcase_05 AC 1,023 ms
4,380 KB
testcase_06 AC 964 ms
4,380 KB
testcase_07 AC 1,135 ms
4,384 KB
testcase_08 AC 40 ms
4,376 KB
testcase_09 AC 39 ms
4,376 KB
testcase_10 AC 40 ms
4,432 KB
testcase_11 AC 40 ms
4,376 KB
testcase_12 AC 39 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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