結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-24 20:00:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 1,500 ms |
| コード長 | 331 bytes |
| コンパイル時間 | 136 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-02 17:03:37 |
| 合計ジャッジ時間 | 1,280 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
a, b = map(int, input().split())
tmp = a + b
lst = []
for i in range(1, int(tmp ** 0.5) + 1):
if tmp % i == 0:
lst.append(i)
lst.append(tmp // i)
for num in lst:
if a == num or b == num:
continue
if (a + num) % b == 0 and (b + num) % a == 0:
print(num)
exit()
print(-1)