結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
7,576 KB
testcase_01 AC 95 ms
7,632 KB
testcase_02 WA -
testcase_03 AC 23 ms
7,784 KB
testcase_04 AC 199 ms
7,736 KB
testcase_05 AC 186 ms
7,724 KB
testcase_06 AC 289 ms
7,784 KB
testcase_07 AC 216 ms
7,640 KB
testcase_08 AC 340 ms
7,624 KB
testcase_09 AC 334 ms
7,644 KB
testcase_10 AC 275 ms
7,632 KB
testcase_11 AC 418 ms
7,628 KB
testcase_12 AC 113 ms
7,656 KB
testcase_13 AC 147 ms
7,728 KB
testcase_14 AC 156 ms
7,628 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 45 ms
7,576 KB
testcase_19 AC 206 ms
7,628 KB
testcase_20 AC 77 ms
7,728 KB
testcase_21 AC 180 ms
7,572 KB
testcase_22 AC 200 ms
7,756 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()

flag = True
for i in xrange(y3):
    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