Accepted
Code
import math as m
t=int(input())
for _ in range(t):
a,b,c,x = map(int,input().split())
lcmm = m.lcm(a,b)
lcmm = m.lcm(lcmm,c)
gcm = (m.ceil(x/lcmm)-1)*lcmm
if(gcm):
print(gcm)
else:
print(-1)
Information
- Submit By
- Type
- Submission
- Problem
- P1025 GCM
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-01-10 09:43:53
- Judged At
- 2024-01-21 15:51:45
- Judged By
- Score
- 100
- Total Time
- 19ms
- Peak Memory
- 2.91 MiB