結果

問題 No.1140 EXPotentiaLLL!
ユーザー ytftytft
提出日時 2021-05-07 18:56:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 467 bytes
コンパイル時間 10,039 ms
コンパイル使用メモリ 370,512 KB
実行使用メモリ 5,392 KB
最終ジャッジ日時 2023-10-13 10:04:12
合計ジャッジ時間 13,858 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 7 ms
4,808 KB
testcase_09 AC 7 ms
4,852 KB
testcase_10 AC 7 ms
4,944 KB
testcase_11 AC 6 ms
4,952 KB
testcase_12 AC 7 ms
4,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;

int main(){
    int N;
    cin>>N;
    long long A,P;
    vector<int> M(500001,1);
    M[1]=0;
    for(int i=2;i<500001;i++){
        if(M[i]){
            for(int j=i*2;j<500001;j+=i){
                M[j]=0;
            }
        }
    }
    for(int i=0;i<N;i++){
        cin>>A>>P;
        cout<<(M[P]*(1+(A%P!=0))-1)<<endl;
    }
    
}
0