結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-14 14:30:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 309 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 87,040 KB |
| 最終ジャッジ日時 | 2024-09-20 00:43:05 |
| 合計ジャッジ時間 | 8,411 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 1 -- * 11 |
ソースコード
import math
T = int(input())
for tt in range(T):
A, P = map(int, input().split())
isPrime = True
lim = int(math.sqrt(P) + 1)
for i in range(2, lim):
if P % i == 0:
isPrime = False
break
if isPrime:
print(P - (A % P))
else:
print(-1)