結果

問題 No.816 Beautiful tuples
ユーザー TEWi_RTEWi_R
提出日時 2019-04-19 22:31:56
言語 Python3
(3.11.2 + numpy 1.24.2 + scipy 1.10.1)
結果
AC  
実行時間 14 ms / 1,500 ms
コード長 497 bytes
コンパイル時間 219 ms
実行使用メモリ 7,820 KB
最終ジャッジ日時 2023-03-31 19:04:59
合計ジャッジ時間 1,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,656 KB
testcase_01 AC 13 ms
7,760 KB
testcase_02 AC 13 ms
7,712 KB
testcase_03 AC 14 ms
7,760 KB
testcase_04 AC 13 ms
7,820 KB
testcase_05 AC 13 ms
7,712 KB
testcase_06 AC 13 ms
7,712 KB
testcase_07 AC 13 ms
7,608 KB
testcase_08 AC 14 ms
7,652 KB
testcase_09 AC 13 ms
7,604 KB
testcase_10 AC 13 ms
7,700 KB
testcase_11 AC 13 ms
7,740 KB
testcase_12 AC 13 ms
7,760 KB
testcase_13 AC 12 ms
7,680 KB
testcase_14 AC 13 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

input_line = input().split()
a = int(input_line[0])
b = int(input_line[1])

max_n = 0
if(a > b):
    big_n = a
    small_n = b
else:
    big_n = b
    small_n = a


def check_c(c):
    if(((a+b) % c) == 0 and (b+c) % a == 0 and (c+a) % b == 0):
        return True
    else:
        return False


c = big_n - small_n
while(c <= big_n+small_n):
    if(c == big_n or c == small_n):
        pass
    elif(check_c(c)):
        print(c)
        exit()
    else:
        pass
    c += big_n

print(-1)
0