結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー |
|
提出日時 | 2020-07-31 21:31:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 613 bytes |
コンパイル時間 | 1,544 ms |
コンパイル使用メモリ | 165,084 KB |
実行使用メモリ | 16,000 KB |
最終ジャッジ日時 | 2024-07-06 16:32:32 |
合計ジャッジ時間 | 4,762 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 WA * 3 |
ソースコード
#include <bits/stdc++.h>const int maxp = 1e7 + 3;int p[maxp], pl;bool isc[maxp];int main() {for(int i = 2; i < maxp; ++i) {if(!isc[i])p[pl++] = i;for(int j = 0; j < pl && i * (long long)p[j] < maxp; ++j) {isc[i * p[j]] = true;if(i % p[j] == 0)break;}}int t;scanf("%d", &t);while(t--) {long long a; int p;scanf("%lld%d", &a, &p);if(isc[p])puts("-1");else if(a % p != 0)puts("1");elseputs("0");}return 0;}