結果

問題 No.186 中華風 (Easy)
ユーザー H3PO4H3PO4
提出日時 2020-05-25 21:05:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-21 03:52:22
合計ジャッジ時間 4,389 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
10,752 KB
testcase_01 AC 89 ms
10,752 KB
testcase_02 AC 88 ms
10,752 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 173 ms
10,752 KB
testcase_05 AC 157 ms
10,752 KB
testcase_06 AC 228 ms
10,752 KB
testcase_07 AC 183 ms
10,752 KB
testcase_08 AC 260 ms
10,880 KB
testcase_09 AC 262 ms
10,752 KB
testcase_10 AC 206 ms
10,752 KB
testcase_11 AC 319 ms
10,880 KB
testcase_12 AC 101 ms
10,752 KB
testcase_13 AC 120 ms
10,752 KB
testcase_14 AC 132 ms
10,752 KB
testcase_15 AC 43 ms
10,752 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 61 ms
10,752 KB
testcase_19 AC 172 ms
10,752 KB
testcase_20 AC 73 ms
10,752 KB
testcase_21 AC 149 ms
10,880 KB
testcase_22 AC 172 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

X1, Y1 = map(int, input().split())
X2, Y2 = map(int, input().split())
X3, Y3 = map(int, input().split())


def solve(n, div_num, mod_num, add_num):
    for _ in range(div_num):
        if n % div_num == mod_num:
            return n
        n += add_num
    else:
        print(-1)
        exit()


n = solve(X1, Y2, X2, Y1)
ans = solve(n, Y3, X3, Y1 * Y2 // gcd(Y1, Y2))
print(ans)
0