結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | onsen_manjuuu |
提出日時 | 2020-08-01 00:57:16 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 576 bytes |
コンパイル時間 | 2,796 ms |
コンパイル使用メモリ | 166,912 KB |
実行使用メモリ | 12,860 KB |
最終ジャッジ日時 | 2023-09-21 04:41:44 |
合計ジャッジ時間 | 13,915 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,274 ms
12,860 KB |
testcase_01 | AC | 1,289 ms
12,640 KB |
testcase_02 | AC | 1,266 ms
12,676 KB |
testcase_03 | AC | 964 ms
12,664 KB |
testcase_04 | AC | 759 ms
12,744 KB |
testcase_05 | AC | 1,160 ms
12,744 KB |
testcase_06 | WA | - |
testcase_07 | AC | 1,282 ms
12,704 KB |
testcase_08 | AC | 102 ms
12,572 KB |
testcase_09 | AC | 93 ms
12,572 KB |
testcase_10 | AC | 97 ms
12,756 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int MAX = 1e7; vector<char> prime(MAX+1); void f() { for(int i = 2; i <= MAX; i++) { if(prime[i])continue; for(int j = i + i; j <= MAX; j += i)prime[j] = true; } } void solve() { ll a, p; cin >> a >> p; if(prime[p]) { cout << -1 << endl; } else if(a % p == 0) { cout << 0 << endl; } else { cout << 1 << endl; } } int main() { // cin.tie(0);ios::sync_with_stdio(0); f(); int T; cin >> T; while(T--)solve(); }