結果

問題 No.186 中華風 (Easy)
ユーザー しらっ亭しらっ亭
提出日時 2015-08-10 20:21:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 7,912 KB
最終ジャッジ日時 2023-09-25 07:58:06
合計ジャッジ時間 4,879 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
7,788 KB
testcase_01 AC 71 ms
7,856 KB
testcase_02 AC 77 ms
7,808 KB
testcase_03 AC 17 ms
7,812 KB
testcase_04 AC 147 ms
7,912 KB
testcase_05 AC 137 ms
7,912 KB
testcase_06 AC 212 ms
7,876 KB
testcase_07 AC 160 ms
7,780 KB
testcase_08 AC 253 ms
7,768 KB
testcase_09 AC 246 ms
7,808 KB
testcase_10 AC 260 ms
7,824 KB
testcase_11 AC 307 ms
7,852 KB
testcase_12 AC 85 ms
7,908 KB
testcase_13 AC 108 ms
7,756 KB
testcase_14 AC 115 ms
7,744 KB
testcase_15 AC 27 ms
7,816 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 49 ms
7,744 KB
testcase_19 AC 153 ms
7,780 KB
testcase_20 AC 58 ms
7,832 KB
testcase_21 AC 135 ms
7,864 KB
testcase_22 AC 149 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a, b):
    m, n = min(a, b), max(a, b)

    while n != 0:
        m, n = n, m % n
    return m


def lcm(a, b):
    return a * b // gcd(a, b)


def solve():
    x1, y1 = list(map(int, input().split()))
    x2, y2 = list(map(int, input().split()))
    x3, y3 = list(map(int, input().split()))

    lcm12 = lcm(y1, y2)

    for a in range(y2):
        p = a * y1 + x1
        if p % y2 == x2:
            for b in range(y3):
                q = b * lcm12 + p
                if q % y3 == x3:
                    print(q)
                    return
    print(-1)


if __name__ == '__main__':
    solve()
0