結果

問題 No.186 中華風 (Easy)
ユーザー kaeru82433413kaeru82433413
提出日時 2024-02-10 22:39:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 364 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 59,804 KB
最終ジャッジ日時 2024-02-10 22:39:13
合計ジャッジ時間 2,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
59,804 KB
testcase_01 AC 42 ms
59,804 KB
testcase_02 AC 46 ms
59,804 KB
testcase_03 AC 39 ms
59,804 KB
testcase_04 AC 46 ms
59,804 KB
testcase_05 AC 45 ms
59,804 KB
testcase_06 AC 56 ms
59,804 KB
testcase_07 AC 47 ms
59,804 KB
testcase_08 AC 56 ms
59,804 KB
testcase_09 AC 54 ms
59,804 KB
testcase_10 AC 54 ms
59,804 KB
testcase_11 AC 60 ms
59,804 KB
testcase_12 AC 41 ms
59,804 KB
testcase_13 AC 48 ms
59,804 KB
testcase_14 AC 44 ms
59,804 KB
testcase_15 AC 39 ms
57,684 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 42 ms
59,804 KB
testcase_19 AC 41 ms
57,556 KB
testcase_20 AC 39 ms
57,556 KB
testcase_21 AC 40 ms
57,556 KB
testcase_22 AC 41 ms
57,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import lcm

XY = [tuple(map(int, input().split())) for _ in range(3)]

rem, mod = XY[0]

ans = -1
for rem_, mod_ in XY[1:]:
    for i in range(mod_):
        if (mod * i + rem) % mod_ == rem_:
            rem = mod * i + rem
            mod = lcm(mod, mod_)
            rem %= mod
            break
    else:
        break
else:
    ans = rem
print(ans)
0