結果

問題 No.186 中華風 (Easy)
ユーザー nebukuro09nebukuro09
提出日時 2017-01-17 13:49:57
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 6,596 KB
実行使用メモリ 7,788 KB
最終ジャッジ日時 2023-08-24 16:37:04
合計ジャッジ時間 5,224 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 95 ms
7,628 KB
testcase_02 WA -
testcase_03 AC 23 ms
7,728 KB
testcase_04 AC 198 ms
7,632 KB
testcase_05 AC 186 ms
7,728 KB
testcase_06 AC 288 ms
7,708 KB
testcase_07 AC 216 ms
7,640 KB
testcase_08 AC 339 ms
7,660 KB
testcase_09 AC 334 ms
7,644 KB
testcase_10 WA -
testcase_11 AC 418 ms
7,788 KB
testcase_12 AC 113 ms
7,628 KB
testcase_13 AC 147 ms
7,684 KB
testcase_14 AC 157 ms
7,724 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 45 ms
7,732 KB
testcase_19 AC 206 ms
7,736 KB
testcase_20 AC 78 ms
7,740 KB
testcase_21 AC 181 ms
7,736 KB
testcase_22 AC 200 ms
7,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import gcd

x1, y1 = map(int, raw_input().split())
x2, y2 = map(int, raw_input().split())
x3, y3 = map(int, raw_input().split())

flag = True
for i in xrange(y2):
    a = x1 + (y1 * i)
    if a % y2 == x2:
        flag = False
        break
    
if flag:
    print -1
    exit()
    
for i in xrange(y3+1):
    b = a + (y1 * y2 * i)
    if b % y3 == x3:
        flag = False
        break
        
if flag:
    print -1
    exit()

print b if b > 0 else y1 * y2 * y3 / gec((gcd(y1, y2), y3))
0