結果
問題 | No.816 Beautiful tuples |
ユーザー |
![]() |
提出日時 | 2020-01-10 18:43:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-23 22:14:21 |
合計ジャッジ時間 | 1,208 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 4 |
ソースコード
def divisor_list_calc(n): res_list = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: res_list.append(i) if n // i != i: res_list.append(n) return res_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]) break if len(res_list) == 0: res = -1 else: res = min(res_list) print(res)