這是求最大公約數(shù)的算法,在這個程序中":="應該就是賦值號,就是把符號右邊變量的值賦給左邊變量,mod是取余的函數(shù),循環(huán)語句中
第一次 a=273 ,b=110 ,a/b的余數(shù)r=53
第二次 a=110 ,b=53 ,r=4
第三次 a=53 ,b=4 ,r=1
第四次 a= 4 ,b=1 ,r=0
因而r 的取值為 D
The Euclidean algorithm is used to find the greatest common divisor (gcd) of two positive integers
The Euclidean algorithm is used to find the greatest common divisor (gcd) of two positive integers
(繼續(xù))a and b.
input (a)
input (b)
while b>0
begin
r:=a mod b
a:=b
b:=r
end
gcd:=a
output(gcd)
When the algorithm is used to find the greatest common divisor of a =273 and b=110, which of the following is the sequence of computed values for r?
(A)2,26,1,0
(B)2,53,1,0
(C)53,2,1,0
(D)53,4,1,0
(E) 53,5,1,0
選D,怎么做的?
程序里的":="是什么意思?
(繼續(xù))a and b.
input (a)
input (b)
while b>0
begin
r:=a mod b
a:=b
b:=r
end
gcd:=a
output(gcd)
When the algorithm is used to find the greatest common divisor of a =273 and b=110, which of the following is the sequence of computed values for r?
(A)2,26,1,0
(B)2,53,1,0
(C)53,2,1,0
(D)53,4,1,0
(E) 53,5,1,0
選D,怎么做的?
程序里的":="是什么意思?
數(shù)學人氣:293 ℃時間:2020-03-29 14:30:31
優(yōu)質解答
我來回答
類似推薦
- 7、The sum of n different positive integers is less than 50.The greatest possible value of n is( )
- 如何證明gcd(a,b)=gcd(a,a+b)
- gcd(a,b)|c
- 一道英語的數(shù)學題. The least integer of consecutive integers is -25.If the sum of these integers is
- If x is the product of the positive integers from 1 to 8
- 一道電能表計算
- 電磁打點計時器和電火花打點計時器哪個誤差大?為什么?
- 簡要說明西歐莊園經濟的特點?
- 2,3,4,5,6,7,8,9這些數(shù)用加,減號怎樣能=10.(負數(shù)也算)
- 當氫氣球飛到天上會怎么樣?
- 鋼筋符號讀法
- for him,it would be a __________to be able to have a day off work.A good B Luxury
猜你喜歡
- 1二次函數(shù)公式 頂點式和一般式的對稱軸,頂點坐標,X和Y的關系,最大值
- 2溫室效應的產生與影響 研究目的
- 3以'"驚喜"為話題的優(yōu)秀作文
- 4造成空氣污染的有害物質可分為( )和( )兩大類,目前計入空氣污染指數(shù)的項目暫定為( )( )( )
- 5Nor的用法
- 6化學肥料主要有______,______,______三大類.含氮量最高的化肥是______,復合肥料是______(填化學式).
- 7已知a2+2ab+b2-4(a+b-1)=0,求a+b-3的值.
- 8電位和電壓有什么異同?
- 91、2位和3、4位是反義詞的成語
- 10大道之行也中是謂大同中大同的今義
- 11Fe與稀硝酸反應分哪兩種情況?
- 12平衡計分卡的指標體系是什么?