20120918 -- 可计算性

程序特性规定:

1 程序开始执行时,自认为一切变元的值为0

2 转向无定义符号,执行程序的最后一条指令 时 自动认为停机

 

y=x+3

y=x+1

y=x+1

y=x+1

y=x

 

 

n(x)=0

x=x+1

 

y=x1+x2

y=x1

[B] TO A IF x2 !=0

  TO E

[A] x2 = x2 -1

  y=y+1

  TO B

y=2x

TO C IF x!=0
TO E
[C] TO A IF x!=0
[B] y=y+1
    z=z-1
    TO B IF z!=0
    TO E
[A]x=x-1
    y=y+1
    z=z+1
    TO C

y=x1*x2

[B]TO A IF x2 != 0
    TO E
[A]x2=x2-1
    y=y+x1
    TO B
[A] TO B IF x1 != 0 
    TO E 
[B] TO C IF x2!=0
     TO E
[C] y=y+x1
    z=z+1
    x2=x2-1
    TO B

y=[x1/x2]

算法思想:

输入x1,连续的减去x2,若x1-x2 还有余,则输出y=y+1.若恰好减完,则输出y。减完后x2之后,若x1仍可以减,重复操作,知道x1剩余小于x2,不再同步减

z1=z1+1 .......执行x2次,进行赋值

TO A IF x1 != 0
TO E
[A] z2= z1
    y=y+1
[B]x1=x1-1
    z2=z2-1
    TO C IF z2 != 0
    TO A IF x1 != 0
[C]TO B IF x1 != 0
    y=y-1
    TO E 

y=根号X

算法思想:

x-(2y+1)-(2y+1)......每次分步执行   x-y1-y1-1

TO A IF x!=0
TO E 
[A] z1= z1+1
    z1=z1+1
[F] TO B IF z1 != 0 
    x=x-1
    TO G IF x!=0
    y=y+1
    TO E 
[B] z2 = y
    TO C IF z2 != 0
    z1 = z1 -1 
    TO F
[C] x= x-1 
    z2 = z2 -1
     TO D IF x != 0
    TO E 
[G] y= y+1
    TO A 

 

 

你可能感兴趣的:(20120918 -- 可计算性)