結果

問題 No.1140 EXPotentiaLLL!
ユーザー 夜
提出日時 2020-08-22 04:33:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 968 ms
コンパイル使用メモリ 92,520 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-04-23 06:54:00
合計ジャッジ時間 12,861 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,288 ms
8,576 KB
testcase_01 AC 1,273 ms
8,320 KB
testcase_02 AC 1,268 ms
8,512 KB
testcase_03 AC 938 ms
8,448 KB
testcase_04 AC 728 ms
8,512 KB
testcase_05 AC 1,142 ms
8,320 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 39 ms
8,320 KB
testcase_09 AC 39 ms
8,320 KB
testcase_10 AC 39 ms
8,376 KB
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
bool b[5000010] = { false };
int main() {
	for (int i = 2; i <= 5000000; i++) {
		if (!b[i]) {
			for (int j = i + i; j <= 5000000; j += i) {
				b[j] = true;
			}
		}
	}
	int t;
	cin >> t;
	long long a, p;
	for (int i = 0; i < t; i++) {
		cin >> a >> p;
		if (b[p]) {
			cout << "-1" << endl;
		}
		else {
			if (a % p != 0 && p % a != 0) {
				cout << "1" << endl;
			}
			else {
				cout << "0" << endl;
			}
		}
	}
	return 0;
}
0