結果

問題 No.3179 3 time mod
ユーザー わん
提出日時 2025-10-20 22:21:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 60,244 KB
最終ジャッジ日時 2025-10-20 22:21:06
合計ジャッジ時間 3,531 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import lcm

N = int(input())
P, Q, R = map(int, input().split())
A, B, C = map(int, input().split())

g = lcm(P, Q, R)
lim = 10**6 + 9
for i in range(lim+1):
  if i%P==A and i%Q==B and i%R==C:
    break
else:
  print(0)
  exit()

ans = (N-i)//g + 1
print(ans)
0