QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#368180 | #3916. A Bishop's Journey | KLPP# | WA | 10ms | 9540kb | Python3 | 145b | 2024-03-26 21:34:42 | 2024-03-26 21:34:42 |
Judging History
answer
n,m=map(int,input().split(" "))
import math
L=math.lcm(n-1,m-1)
ans=L+1
Cnt=L//(n-1)+L//(m-1)-1
Cnt//=2
ans-=(Cnt*(Cnt-1))//2
print(ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 9ms
memory: 9488kb
input:
15 22
output:
42
result:
ok 1 number(s): "42"
Test #2:
score: 0
Accepted
time: 0ms
memory: 9492kb
input:
5 4
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 7ms
memory: 9440kb
input:
2 4
output:
4
result:
ok 1 number(s): "4"
Test #4:
score: 0
Accepted
time: 10ms
memory: 9540kb
input:
4 3
output:
6
result:
ok 1 number(s): "6"
Test #5:
score: -100
Wrong Answer
time: 5ms
memory: 9516kb
input:
6 9
output:
26
result:
wrong answer 1st numbers differ - expected: '27', found: '26'