Type: Default 1000ms 256MiB

判断整除

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

一个给定的正整数序列,在每个数之前都插入+号或-号后计算它们的和。比如序列:1、2、4共有8种可能的序列:

(+1) + (+2) + (+4) = 7

(+1) + (+2) + (-4) = -1

(+1) + (-2) + (+4) = 3

(+1) + (-2) + (-4) = -5

(-1) + (+2) + (+4) = 5

(-1) + (+2) + (-4) = -3

(-1) + (-2) + (+4) = 1

(-1) + (-2) + (-4) = -7

所有结果中至少有一个可被整数k整除,我们则称此正整数序列可被k整除。例如上述序列可以被3、5、7整除,而不能被2、4、6、8……整除。注意:0、-3、-6、-9……都可以认为是3的倍数。

## Input Format

输入的第一行包含两个数:N(2<N<10000)和k(2<k<100),其中N代表一共有N个数,k代表被除数。第二行给出序列中的N个整数,这些整数的取值范围都0到10000之间(可能重复)。

## Output Format

如果此正整数序列可被k整除,则输出YES,否则输出NO。(注意:都是大写字母)

```input1 3 2 1 2 4

```output1
NO

2026-4-26递推练习

Not Attended
Status
Done
Rule
XCPC
Problem
9
Start at
2026-4-26 13:30
End at
2026-4-26 16:30
Duration
3 hour(s)
Host
Partic.
8