結果

問題 No.2117 中国剰余定理入門
ユーザー u_kunu_kun
提出日時 2022-11-04 21:29:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 75,820 KB
最終ジャッジ日時 2023-09-25 23:41:36
合計ジャッジ時間 2,910 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,084 KB
testcase_01 AC 70 ms
71,036 KB
testcase_02 AC 71 ms
71,176 KB
testcase_03 AC 71 ms
71,288 KB
testcase_04 AC 71 ms
71,052 KB
testcase_05 AC 80 ms
75,600 KB
testcase_06 AC 70 ms
71,068 KB
testcase_07 AC 80 ms
75,572 KB
testcase_08 AC 77 ms
75,580 KB
testcase_09 AC 68 ms
71,212 KB
testcase_10 AC 68 ms
71,080 KB
testcase_11 AC 68 ms
71,060 KB
testcase_12 AC 75 ms
75,696 KB
testcase_13 AC 73 ms
75,556 KB
testcase_14 AC 81 ms
75,592 KB
testcase_15 AC 75 ms
75,800 KB
testcase_16 AC 74 ms
75,696 KB
testcase_17 AC 73 ms
75,820 KB
testcase_18 AC 78 ms
75,592 KB
testcase_19 AC 70 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

B0, C0 = map(int, input().split())
B1, C1 = map(int, input().split())

def mod_equal(A, B, dev):
    """Aをdevで割った余りとBをdevで割った余りが等しければTrue"""
    
    if A % dev == B % dev:
        return True

for n in range(1000000):
    if mod_equal(n, C0, B0) and mod_equal(n, C1, B1):
        print(n)
        exit()


print("NaN")
    
0