VF算法总结_vf总结

2020-02-27 其他工作总结 下载本文

VF算法总结由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“vf总结”。

资源网站http://www.daodoc.com http://www.daodoc.com/助你专升本

1.递推算法(常用级数、数列求和、二分法、梯形积分法、穷举法等); * 1+1/2+1/3+1/4+...+1/n clear input '请输入n的值:N=' to n s=0 for i=1 to n s=s+1/i endfor ?S

* 1 1 2 3 5 8 13.....clear input '请输入n的值:N=' to n dimension a[n] a[1]=1 a[2]=1 s=2 for i=3 to n a[i]=a[i-1]+a[i-2] s=s+a[i] endfor ?S

*二分法解方程3x*x*x-4x*x+3x-6=0要求误差小于十的负六次方 clear input 'x1=' to x1 input 'x2=' to x2 fx1=x1*((3*x1-4)*x1+3)-6 fx2=x2*((3*x2-4)*x2+3)-6 do while fx1*fx2 > 0 input 'x1=' to x1 input 'x2=' to x2 fx1=x1*((3*x1-4)*x1+3)-6 fx2=x2*((3*x2-4)*x2+3)-6 enddo x0=(x1+x2)/2 fx0=x0*((3*x0-4)*x0+3)-6 do while abs(fx0)>=0.000001 x0=(x1+x2)/2 fx1=x1*((3*x1-4)*x1+3)-6

资源网站http://www.daodoc.com clear input 'N=' to n dimension a[n] for i=1 to n input 'a['+str(i,2,1)+']=' to a[i] endfor for i=1 to n-1 p=i for j=i+1 to n If a[j]i temp=a[i] a[i]=a[p] a[p]=temp endif endfor for i=1 to n ?? a[i] endfor

clear input '请输入n的值:N=' to n dimension a[n] for i=1 to n input '请输入第'+str(i)+'个数:'to a[i] endfor for i=1 to n-1 for j=1 to n-i if a[i]>a[j] temp=a[i] a[i]=a[j] a[j]=temp endif endfor endfor for i=1 to n ?a[i] endfor

资源网站http://www.daodoc.com exit endif if a[mid]num iend=mid-1 endif enddo if start

4.有序数列的插入、删除操作; clear input “N=” to n dimension a[100] for i=1 to n input 'a['+str(i,2,1)+']=' to a[i] endfor for i=1 to n for j=i+1 to n if a[i]>a[j] temp=a[i] a[i]=a[j] a[j]=temp endif endfor endfor input “insert num=” to num for i=1 to n if a[i]>num exit endif endfor for j=n to i step-1 a[j+1]=a[j] endfor a[i]=num

资源网站http://www.daodoc.com 素数等); clear input '请输入个数:'to n dimension a[n] for i=1 to n input '请输入第'+str(i)+'个数:'to a[i] endfor maxnum=a[1] minnum=a[1] for i=2 to n if a[i]>maxnum maxnum=a[i] endif if a[i]

clear store 0 to m,n,t,temp input '请输入第一个数:'to m input '请输入第二个数:'to n if n0 r=n%m n=m m=r enddo ?'最大公约数是:',n ?'最小公倍数是:',p/n

clear for i=2 to 100 for j=2 to i if INT(i/j)=i/j

资源网站http://www.daodoc.com ??a[i,j] endfor ? endfor

for i=1 to n temp=a[i,1] k=1 for j=1 to n if a[i,j]>temp temp=a[i,j] k=j endif endfor for r=1 to n if a[r,k]n ? temp endif endfor

7.递归算法(阶乘、最大公约数等);

clear input “N=” to n ?str(n)+“!=”+str(jc(n))function jc parameters k if k=1 return 1 else return k * jc(k-1)Endif

clear input “N=” to n input “M=” to m

《VF算法总结.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
VF算法总结
点击下载文档
相关专题 vf总结 算法 VF vf总结 算法 VF
[其他工作总结]相关推荐
    [其他工作总结]热门文章
      下载全文