B. [USACO][2009][MAR][S] Cow Frisbee Team

    传统题 1000ms 256MiB

[USACO][2009][MAR][S] Cow Frisbee Team

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

After Farmer Don took up Frisbee, Farmer John wanted to join in the fun. He wants to form a Frisbee team from his N cows (1 <= N <= 2,000) conveniently numbered 1..N. The cows have been practicing flipping the discs around, and each cow i has a rating RiR_i (1 <= RiR_i <= 100,000) denoting her skill playing Frisbee. FJ can form a team by choosing one or more of his cows.

However, because FJ needs to be very selective when forming Frisbee teams, he has added an additional constraint. Since his favorite number is F (1 <= F <= 1,000), he will only accept a team if the sum of the ratings of each cow in the team is exactly divisible by F.

Help FJ find out how many different teams he can choose. Since this number can be very large, output the answer modulo 100,000,000.

Format

Input

  • Line 1: Two space-separated integers: N and F
  • Lines 2..N+1: Line i+1 contains a single integer: RiR_i

Output

  • Line 1: A single integer representing the number of teams FJ can choose, modulo 100,000,000.

Details

INPUT DETAILS:

FJ has four cows whose ratings are 1, 2, 8, and 2. He will only accept a team whose rating sum is a multiple of 5.

OUTPUT DETAILS:

FJ can pair the 8 and either of the 2's (8 + 2 = 10), or he can use both 2's and the 1 (2 + 2 + 1 = 5).

Samples

4 5
1
2
8
2
3

Limitation

about 50% of the test data will have N <= 19.

USACO 月赛模拟赛

未参加
状态
已结束
规则
OI
题目
4
开始于
2022-3-5 8:30
结束于
2022-3-5 12:30
持续时间
4 小时
主持人
参赛人数
2