結果

問題 No.2119 一般化百五減算
ユーザー sepa38sepa38
提出日時 2022-11-04 21:33:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 78,912 KB
最終ジャッジ日時 2023-09-25 23:48:36
合計ジャッジ時間 4,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,276 KB
testcase_01 AC 90 ms
70,972 KB
testcase_02 AC 88 ms
71,316 KB
testcase_03 AC 88 ms
71,272 KB
testcase_04 AC 94 ms
76,736 KB
testcase_05 AC 88 ms
71,300 KB
testcase_06 AC 90 ms
71,132 KB
testcase_07 AC 101 ms
76,952 KB
testcase_08 AC 90 ms
71,124 KB
testcase_09 AC 97 ms
76,540 KB
testcase_10 AC 89 ms
71,348 KB
testcase_11 AC 90 ms
71,272 KB
testcase_12 AC 94 ms
76,548 KB
testcase_13 AC 86 ms
71,372 KB
testcase_14 AC 89 ms
71,292 KB
testcase_15 AC 89 ms
71,300 KB
testcase_16 AC 90 ms
71,280 KB
testcase_17 AC 86 ms
71,368 KB
testcase_18 AC 86 ms
71,260 KB
testcase_19 AC 87 ms
71,364 KB
testcase_20 AC 154 ms
78,848 KB
testcase_21 AC 150 ms
78,244 KB
testcase_22 AC 170 ms
78,752 KB
testcase_23 AC 167 ms
78,912 KB
testcase_24 AC 169 ms
78,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n = int(input())
d = deque([i for i in range(n+1)])
m = int(input())
for _ in range(m):
  b, c = map(int, input().split())
  c %= b
  for i in range(len(d)):
    x = d.popleft()
    if x % b == c:
      d.append(x)
print(d[0] if d else "NaN")
0