結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-11-10 00:32:08 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 116 ms / 1,500 ms |
| + 880µs | |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 21,412 KB |
| 実行使用メモリ | 15,996 KB |
| 最終ジャッジ日時 | 2026-08-23 10:39:57 |
| 合計ジャッジ時間 | 3,047 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
A, B = map(int, input().split())
def is_ok(A, B, C):
return A != C and B != C and (A + B) % C == 0 and (A + C) % B == 0 and (B + C) % A == 0
result = -1
for i in range(1, int((A + B) ** 0.5) + 1):
for C in [i, (A + B) // i]:
if is_ok(A, B, C):
if result == -1:
result = C
else:
result = min(result, C)
print(result)
c-yan