我尝试了一些似乎有用的算法。希望大家都能帮忙检查一下......
解决方案1:
Start
Get num1, num2
Set max_num1 = num1
set lcm = 0
loop:counter = 1 to 100 Step 1
if max_num1%num2==0
lcm = max_num1
else
max_num1 = max_num1 + num1
endif
loop-end:counter
print lcm
End
解决方案2:
Start
Get num1, num2
set lcm = 0
loop:counter = 1 to 100 Step num1
if num1%num2==0
lcm = num1
else
num1 = num1 + num1 - counter
endif
loop-end:counter
print lcm
End
答案 0 :(得分:0)
我希望这会有所帮助。