QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#368180#3916. A Bishop's JourneyKLPP#WA 10ms9540kbPython3145b2024-03-26 21:34:422024-03-26 21:34:42

Judging History

你现在查看的是最新测评结果

  • [2024-03-26 21:34:42]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:9540kb
  • [2024-03-26 21:34:42]
  • 提交

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'