Skip to content

Commit

Permalink
28차시 문제 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
alstjr7437 committed May 30, 2024
1 parent eb24120 commit e2eda50
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions alstjr7437/브루트포스/카잉-달력.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sys

input = sys.stdin.readline

t = int(input())

for _ in range(t):
m, n, x, y = map(int, input().split())

k = x # k를 x로 초기화
result = -1
while k <= m * n: # k의 범위는 m*n을 넘을 수 없게
if (k - x) % m == 0 and (k - y) % n == 0:
result = k
break
k += m

print(result) # 결과값 출력

0 comments on commit e2eda50

Please sign in to comment.