結果

問題 No.1140 EXPotentiaLLL!
ユーザー beetbeet
提出日時 2020-07-31 21:32:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 1,820 ms
コンパイル使用メモリ 198,372 KB
実行使用メモリ 42,776 KB
最終ジャッジ日時 2023-09-20 21:52:32
合計ジャッジ時間 16,047 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 921 ms
42,424 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 854 ms
42,424 KB
testcase_09 AC 866 ms
42,512 KB
testcase_10 AC 847 ms
42,440 KB
testcase_11 AC 863 ms
42,584 KB
testcase_12 AC 846 ms
42,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
const int MAX = 1e7;
int dp[MAX]={};
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  for(int i=2;i<MAX;i++)
    for(int j=i+i;j<MAX;j+=i) dp[j]++;

  dp[0]=dp[1]=1;

  int T;
  cin>>T;
  while(T--){
    int A,P;
    cin>>A>>P;
    if(dp[P]) cout<<-1<<newl;
    else cout<<(A%P==0?0:1)<<newl;
  }
  return 0;
}
0