結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| ユーザー |
DAyamaCTF
|
| 提出日時 | 2020-07-31 21:42:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 229 ms / 2,000 ms |
| コード長 | 1,060 bytes |
| コンパイル時間 | 1,767 ms |
| コンパイル使用メモリ | 159,080 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-07-06 17:10:19 |
| 合計ジャッジ時間 | 5,677 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%d",&T);
| ~~~~~^~~~~~~~~
main.cpp:43:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
43 | scanf("%lld%lld",&A,&B);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
const int m=5000010;
bool isprime[5000010];
int main(){
rep(i,m)isprime[i]=true;
isprime[0]=isprime[1]=false;
for(int i=2;i<m;i++){
if(!isprime[i])continue;
for(int j=2*i;j<m;j+=i){
isprime[j]=false;
}
}
int T;
scanf("%d",&T);
while(T--){
ll A,B;
scanf("%lld%lld",&A,&B);
A%=B;
if(!isprime[B]){
printf("-1\n");
}else{
if(A==0)printf("0\n");
else printf("1\n");
}
}
return 0;
}
DAyamaCTF