結果

問題 No.816 Beautiful tuples
ユーザー 双六双六
提出日時 2019-04-19 21:57:01
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 16 ms / 1,500 ms
コード長 293 bytes
コンパイル時間 61 ms
使用メモリ 7,792 KB
最終ジャッジ日時 2022-11-22 09:30:48
合計ジャッジ時間 1,314 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,740 KB
testcase_01 AC 15 ms
7,792 KB
testcase_02 AC 15 ms
7,688 KB
testcase_03 AC 15 ms
7,680 KB
testcase_04 AC 15 ms
7,628 KB
testcase_05 AC 15 ms
7,600 KB
testcase_06 AC 16 ms
7,680 KB
testcase_07 AC 16 ms
7,560 KB
testcase_08 AC 15 ms
7,744 KB
testcase_09 AC 16 ms
7,748 KB
testcase_10 AC 15 ms
7,688 KB
testcase_11 AC 15 ms
7,740 KB
testcase_12 AC 15 ms
7,692 KB
testcase_13 AC 15 ms
7,640 KB
testcase_14 AC 15 ms
7,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def getlist():
	return list(map(int, input().split()))

A, B = getlist()
A, B = sorted([A, B])
if B % A != 0:
	if B % (B - A) == 0 and int(B // (B - A)) == 3:
		print(B - A)
	else:
		print(-1)
else:
	if int(B // A) == 2:
		print(A * 3)
	elif int(B // A) == 3:
		print(A * 2)
	else:
		print(-1)
0