結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2019-04-19 21:30:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 1,500 ms |
| コード長 | 312 bytes |
| コンパイル時間 | 577 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-22 16:42:10 |
| 合計ジャッジ時間 | 1,506 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
A,B=map(int,input().split())
x=A+B
import math
xr=math.ceil(math.sqrt(x))
LIST=[]
for i in range(1,xr+1):
if x%i==0:
LIST.append(i)
LIST.append(x//i)
LIST.sort()
for l in LIST:
if (A+l)%B==0 and (B+l)%A==0 and A!=l and B!=l and A!=B:
print(l)
break
else:
print(-1)
titia