結果

問題 No.1140 EXPotentiaLLL!
ユーザー mmn15277198
提出日時 2021-06-07 22:05:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 168,752 KB
実行使用メモリ 24,776 KB
最終ジャッジ日時 2024-11-25 04:10:16
合計ジャッジ時間 16,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int MX = 5500000;
int main() {
  vector<int> prime(MX , 0);
  for (int i = 2; i < MX; i++) {
    for (int j = i; j < MX; j += i) {
      prime[j]++;
    }
  }
  int t;
  cin >> t;
  while (t--) {
    long long a;
    int p;
    cin >> a >> p;
    if (prime[p] > 1) {
      cout << -1 << endl;
    } else if(a == 1) {
      cout << 1 << endl;
    } else {
      if (a % p == 0) cout << 0 << endl;
      else cout << 1 << endl;
    }
  }
  return 0;
}
0