結果

問題 No.2117 中国剰余定理入門
ユーザー ygd.ygd.
提出日時 2022-11-06 21:16:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 345 ms / 2,000 ms
コード長 788 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-09-27 14:43:10
合計ジャッジ時間 5,105 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
72,804 KB
testcase_01 AC 97 ms
72,656 KB
testcase_02 AC 102 ms
72,752 KB
testcase_03 AC 102 ms
72,900 KB
testcase_04 AC 103 ms
72,472 KB
testcase_05 AC 331 ms
76,752 KB
testcase_06 AC 97 ms
72,848 KB
testcase_07 AC 345 ms
76,668 KB
testcase_08 AC 290 ms
76,784 KB
testcase_09 AC 101 ms
72,908 KB
testcase_10 AC 102 ms
72,660 KB
testcase_11 AC 97 ms
72,800 KB
testcase_12 AC 247 ms
76,620 KB
testcase_13 AC 104 ms
76,944 KB
testcase_14 AC 240 ms
76,872 KB
testcase_15 AC 100 ms
76,736 KB
testcase_16 AC 103 ms
76,780 KB
testcase_17 AC 99 ms
76,784 KB
testcase_18 AC 237 ms
76,924 KB
testcase_19 AC 101 ms
72,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import math
import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict
#from collections import deque
import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    b0,c0 = map(int,input().split())
    b1,c1 = map(int,input().split())

    for x in range(10000000):
        if (x-c0)%b0 == 0 and (x-c1)%b1 == 0:
            exit(print(x))
    print('NaN')



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