option explicit
dim n as integer
private sub command1_click()
dim a as integer,b as integer
a=2:b=3
for n=1 to 6
if n mod 2 =0 then
b=fun(n,a) +a
else
a=fun(b,n) +b
end if
next n
print n,a ,b
end sub
private function fun (x as integer,y as integer) as integer
x=y-1+n
y=x+y-n
fun =x+y
end function
dim n as integer
private sub command1_click()
dim a as integer,b as integer
a=2:b=3
for n=1 to 6
if n mod 2 =0 then
b=fun(n,a) +a
else
a=fun(b,n) +b
end if
next n
print n,a ,b
end sub
private function fun (x as integer,y as integer) as integer
x=y-1+n
y=x+y-n
fun =x+y
end function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货