結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
59,804 KB
testcase_01 AC 41 ms
59,804 KB
testcase_02 AC 45 ms
59,804 KB
testcase_03 AC 39 ms
59,804 KB
testcase_04 AC 44 ms
59,804 KB
testcase_05 AC 45 ms
59,804 KB
testcase_06 AC 55 ms
59,804 KB
testcase_07 AC 45 ms
59,804 KB
testcase_08 AC 54 ms
59,804 KB
testcase_09 AC 53 ms
59,804 KB
testcase_10 AC 70 ms
59,804 KB
testcase_11 AC 60 ms
59,804 KB
testcase_12 AC 41 ms
59,804 KB
testcase_13 AC 47 ms
59,804 KB
testcase_14 AC 45 ms
59,804 KB
testcase_15 AC 38 ms
57,684 KB
testcase_16 AC 35 ms
53,588 KB
testcase_17 AC 34 ms
53,588 KB
testcase_18 AC 43 ms
59,804 KB
testcase_19 AC 42 ms
57,556 KB
testcase_20 AC 38 ms
57,556 KB
testcase_21 AC 39 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-1)%mod+1
print(ans)
0