Skip to content
CalcGospel 國際數學圖譜
返回

IAL 2023 June D1 Q3

A Level / Edexcel / D1

IAL 2023 June Paper · Question 3

题目

Problem

In this question, the function INT(XX) is the largest integer less than or equal to XX. For example, INT(5.7) = 5, INT(8) = 8, INT(−2.3) = −3.

Consider the following algorithm.

Step 1: Input NN

Step 2: Calculate A=N÷10A = N \div 10

Step 3: Let BB = INT(AA)

Step 4: Calculate C=B×10C = B \times 10

Step 5: Calculate D=NCD = N - C

Step 6: Output DD

Step 7: Replace NN by BB

Step 8: If N=0N = 0 then STOP, otherwise go back to Step 2

(a) Complete the table in the answer book, using N=4217N = 4217, to show the results obtained at each step of the algorithm.

(4)

(b) Explain how the output values of the algorithm relate to the original input NN, where NN is any positive integer.

(2)
题目中文翻译

在此问题中,函数 INT(XX) 是小于或等于 XX 的最大整数。例如,INT(5.7) = 5,INT(8) = 8,INT(−2.3) = −3。

考虑以下算法。

第 1 步:输入 NN

第 2 步:计算 A=N÷10A = N \div 10

第 3 步:设 BB = INT(AA)

第 4 步:计算 C=B×10C = B \times 10

第 5 步:计算 D=NCD = N - C

第 6 步:输出 DD

第 7 步:用 BB 替换 NN

第 8 步:如果 N=0N = 0 则停止,否则回到第 2 步

(a) 使用 N=4217N = 4217 完成答案本中的表格,显示算法每一步获得的结果。

(b) 解释算法的输出值与原始输入 NN 之间的关系,其中 NN 是任意正整数。

解答

(a)

解法一

思路

展开

每轮先把当前 NN 除以 10,再取整数部分得到 BB。这样 C=10BC=10B 是删去当前个位数后的整十部分,而 D=NCD=N-C 就是被删去的个位数。随后用 BB 替换 NN,重复到 N=0N=0

答题过程

展开

The completed table is

NNA=N÷10A=N\div10B=INT(A)B=\operatorname{INT}(A)C=10BC=10BD=NCD=N-C
4217421.742142107
42142.1424201
424.24402
40.4004
0

Therefore the output values, in order, are

7,1,2,4.\boxed{7,1,2,4}.

(b)

解法一

思路

展开

每轮输出当前 NN 的个位数,然后把该个位数删去。因此输出依次是原输入的个位、十位、百位,直到最高位,也就是把原输入的各位数字反向输出。

答题过程

展开

For any positive integer NN, the first output is the units digit, the second output is the tens digit, the third output is the hundreds digit, and so on.

Hence the algorithm outputs the digits of the original input NN in reverse order.