20120918 -- 可計算性

程序特性規定:算法

1 程序開始執行時,自認爲一切變元的值爲0spa

2 轉向無定義符號,執行程序的最後一條指令 時 自動認爲停機code

 

y=x+3blog

y=x+1 y=x+1 y=x+1 y=x

 

 

n(x)=0同步

x=x+1class

 

y=x1+x2程序

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

y=2xdi

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*x2co

[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 
相關文章
相關標籤/搜索