← Back to List

20410번: 추첨상 사수 대작전! (Easy) ↗

Solutions

Python 3
188 B | 188 chars
def main():
  m,s,x1,x2=map(int,input().split())
  for a in range(0, m):
    for c in range(0, m):
      if x1 == (a*s+c)%m and x2 == (a*x1+c)%m:
        print(a, c)
        return
main()