結果

問題 No.1140 EXPotentiaLLL!
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-31 21:59:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 817 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 96,304 KB
実行使用メモリ 11,980 KB
最終ジャッジ日時 2023-09-20 23:15:16
合計ジャッジ時間 8,374 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
 
const int inf = (int)1e9; 
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}


int main(void){
	ll T;
	cin>>T;
	for(int i=0;i<T;i++){
		ll a,p;
		cin>>a>>p;
		bool flag = false;
		for(ll i=2;i*i<=p;i++){
			if(p%i==0){
				flag = true;
				break;
			}
		}
		if(flag)cout<<-1<<endl;
		else{
			if(a%p==0)cout<<0<<endl;
			else cout<<1<<endl;
		}
	}
	return 0;
}
0