結果

問題 No.1140 EXPotentiaLLL!
ユーザー Sooh31
提出日時 2020-07-31 22:06:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 400 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 192,876 KB
最終ジャッジ日時 2025-01-12 10:14:21
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 5 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std; 
using ll = long long;

bool is_prime(ll p){
    for(int i = 2; i * i <= p; i++){
        if(p % i == 0) return false;
    }
    return true;
}
int main(){
    int t; cin >> t;
    while(t--){
        ll a, p; cin >> a >> p;
        if(is_prime(p)){
            cout << 1 << endl;
        }
        else{
            cout << -1 << endl;
        }
    }
}
0