結果
問題 |
No.816 Beautiful tuples
|
ユーザー |
|
提出日時 | 2019-04-20 09:11:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 684 bytes |
コンパイル時間 | 116 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-25 06:25:36 |
合計ジャッジ時間 | 1,301 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 2 |
ソースコード
# -*- coding: utf-8 -*- import sys import copy sys.setrecursionlimit(1000000) # input = sys.stdin.readline # ~~~~~~~~~~~~~~~~~~~~~_(^~^ 」 ∠)_~~~~~~~~~~~~~~~~~~~~~ def get_divisors(x): ret = [] i = 1 while i * i <= x: if x % i == 0: ret.append(i) if x // i != i: ret.append(x // i) i += 1 ret = sorted(ret) return ret A, B = map(int, input().split()) divisors = get_divisors(A + B); ans = 100000000000000000000 for C in divisors: if (A + C) % B == 0 and (B + C) % A == 0 and A != B and B != C and A != B: ans = min(ans, C) print(ans if ans != 100000000000000000000 else -1)