結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-07 09:20:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 246 ms / 2,000 ms |
| コード長 | 465 bytes |
| コンパイル時間 | 631 ms |
| コンパイル使用メモリ | 63,104 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-09-22 17:35:55 |
| 合計ジャッジ時間 | 4,742 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
#include<iostream>
using namespace std;
typedef long long ll;
bool nonp[5000001] = {};
int main(){
nonp[1] = true;
for(int i = 2; i < 5000001; i++){
if(nonp[i]) continue;
for(int j = i+i; j < 5000001; j += i){
nonp[j] = true;
}
}
int t;
scanf("%d", &t);
ll a;
int p;
while(t-- > 0){
scanf("%lld %d", &a, &p);
printf("%d\n", nonp[p] ? -1 : a%p==0 ? 0 : 1);
}
return 0;
}