結果
問題 | No.816 Beautiful tuples |
ユーザー |
|
提出日時 | 2022-05-01 22:02:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 40 ms / 1,500 ms |
コード長 | 299 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-30 23:30:29 |
合計ジャッジ時間 | 1,206 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
a, b = map(int, input().split()) s = a + b f = 1 ans = 10**18 + 1 while f * f <= s: if s % f == 0: for c in (f, s // f): if (b + c) % a == 0 and (c + a) % b == 0 and c not in (a, b): ans = min(ans, c) f += 1 if ans == 10**18 + 1: ans = -1 print(ans)