結果

問題 No.1140 EXPotentiaLLL!
ユーザー koba-e964
提出日時 2021-09-18 11:23:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 429 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,852 KB
実行使用メモリ 89,976 KB
最終ジャッジ日時 2024-06-30 08:35:34
合計ジャッジ時間 8,763 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

def is_prime(n):
    if n <= 1:
        return False
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True


t = int(input())
for _ in range(t):
    a, p = map(int, input().split())
    if is_prime(p):
        print(0 if a % p == 0 else 1)
    else:
        print(-1)
0