文件名称:DevideExactly
介绍说明--下载内容均来自于网络,请自行研究使用
整除问题
考虑一个任意的整数序列。在这个序列的两个数之间可以插入运算符“+”或者“-”,这样得到不同的算术表达式,经过运算,每个表达式得到一个结果。让我们考虑下面的一个例子:17, 5, -21, 15。这个序列有8个可能的算术表达式:
17 + 5 + (-21) + 15 = 1617 + 5 + (-21) - 15 = -1417 + 5 - (-21) + 15 = 5817 + 5 - (-21) - 15 = 2817 - 5 + (-21) + 15 = 617 - 5 + (-21) - 15 = 2417 - 5 - (-21) + 15 = 4817 - 5 - (-21) - 15 = 18如果上述八个表达式中的某个能被 k 整除,那么我们成这个整数序列能被 k 整除。在上例中,序列能被 7 整除 (17+5+(-21)-15=-14),但却不能被 5 整除。
要求你写出一个程序来测试输入序列能否被 k 整除。
输入
输入第一行包括两个整数 N 和 k,其中 1 <= N <= 10000,2 <= k <= 100,他们之间以空格分开。
第二行是由N个整数组成的序列,整数与整数之间用空格分开,每个整数的绝对值不超过10000。
输出
如果序列能被 k 整除,那么输出 Yes,否则输出 No。 -divides that into an arbitrary integer sequence. In the sequence between the two could be inserted several Operators, "" or "-", which is different arithmetic expression After operations, each received an expression of the results. Let us consider the following example : A 17, 5, 21, 15. The sequence of eight possible arithmetic expression : 17 5 (21) 15 1617 5 = (-21) - 15 = -1417 5 - (-21) 15 = 5817 5 - (-21) - 15 = 2817-5 (-21) 15 = 617-5 (-21) - 15 = 2417-5 - (-21) 15 = 4817-5 - (-21) - 15 = 18 If the above 8 expression of a certain k be divisible, then we become the integer k sequence can be divisible. In the last case, the sequences can be divided by seven (17 5 (-21) -15 =- 14), but not divisible by five. Ask you to write a procedure to test sequences can be impo
考虑一个任意的整数序列。在这个序列的两个数之间可以插入运算符“+”或者“-”,这样得到不同的算术表达式,经过运算,每个表达式得到一个结果。让我们考虑下面的一个例子:17, 5, -21, 15。这个序列有8个可能的算术表达式:
17 + 5 + (-21) + 15 = 1617 + 5 + (-21) - 15 = -1417 + 5 - (-21) + 15 = 5817 + 5 - (-21) - 15 = 2817 - 5 + (-21) + 15 = 617 - 5 + (-21) - 15 = 2417 - 5 - (-21) + 15 = 4817 - 5 - (-21) - 15 = 18如果上述八个表达式中的某个能被 k 整除,那么我们成这个整数序列能被 k 整除。在上例中,序列能被 7 整除 (17+5+(-21)-15=-14),但却不能被 5 整除。
要求你写出一个程序来测试输入序列能否被 k 整除。
输入
输入第一行包括两个整数 N 和 k,其中 1 <= N <= 10000,2 <= k <= 100,他们之间以空格分开。
第二行是由N个整数组成的序列,整数与整数之间用空格分开,每个整数的绝对值不超过10000。
输出
如果序列能被 k 整除,那么输出 Yes,否则输出 No。 -divides that into an arbitrary integer sequence. In the sequence between the two could be inserted several Operators, "" or "-", which is different arithmetic expression After operations, each received an expression of the results. Let us consider the following example : A 17, 5, 21, 15. The sequence of eight possible arithmetic expression : 17 5 (21) 15 1617 5 = (-21) - 15 = -1417 5 - (-21) 15 = 5817 5 - (-21) - 15 = 2817-5 (-21) 15 = 617-5 (-21) - 15 = 2417-5 - (-21) 15 = 4817-5 - (-21) - 15 = 18 If the above 8 expression of a certain k be divisible, then we become the integer k sequence can be divisible. In the last case, the sequences can be divided by seven (17 5 (-21) -15 =- 14), but not divisible by five. Ask you to write a procedure to test sequences can be impo
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 65520789devideexactly.rar 列表 DevideExactly.c