結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
![]() |
提出日時 | 2020-07-31 21:55:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 542 bytes |
コンパイル時間 | 2,774 ms |
コンパイル使用メモリ | 192,116 KB |
最終ジャッジ日時 | 2025-01-12 09:56:13 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 TLE * 3 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int isPrime(int x){ if(x<2) return 0; else if(x==2) return 1; if(x%2==0) return 0; for(int i=3;i*i<=x;i+=2){ if(x%i==0) return 0; } return 1; } int main(){ int t; cin>>t; while(t--){ ll a,p; cin>>a>>p; if(!isPrime(p)){ cout<<-1<<endl; continue; } if(a%p==0) cout<<0<<endl; else cout<<1<<endl; } return 0; }