結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
_KingdomOfMoray
|
| 提出日時 | 2020-01-10 18:49:13 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 707 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-23 22:14:22 |
| 合計ジャッジ時間 | 1,199 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 4 |
ソースコード
def divisor_list_calc(n):
divisor_list = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
divisor_list.append(i)
if n // i != i:
divisor_list.append(n)
return divisor_list
a, b = map(int,input().split())
c_list = divisor_list_calc(a + b)
res_list = []
for i in range(len(c_list)):
cond_list = []
cond_list.append((b + c_list[i]) % a == 0)
cond_list.append((a + c_list[i]) % b == 0)
cond_list.append(a != c_list[i])
cond_list.append(b != c_list[i])
if all(cond_list):
res_list.append(c_list[i])
if len(res_list) == 0:
res = -1
else:
res = min(res_list)
print(res)
_KingdomOfMoray