Created
May 13, 2015 16:00
-
-
Save igaryhe/e25bd4d090b2e271b66c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAXM 100 | |
#define MAX 2000 | |
#define MOD 1000000007 | |
int main() { | |
int m, r, s; | |
int array[MAXM + 10]; | |
scanf("%d %d %d", &m, &r, &s); | |
int a = (r + s)/2, b = (r - s)/2; | |
for (int i = 0; i < m; ++i) { | |
int in; | |
scanf("%d", &in); | |
array[i] = in; | |
} | |
long long dp[MAXM + 10][MAX + 10] = {0}; | |
if (a != 0 && b != 0) dp[0][0] = 1; | |
for (int i = 0; i < m; ++i) { | |
for (long long j = m; j > 0; --j) { | |
for (int k = a; k >= 0; --k) { | |
if (k >= array[i]) { | |
dp[j][k] = (dp[j][k] + dp[j - 1][k - array[i]]) % MOD; | |
} | |
} | |
} | |
} | |
long long count = 0; | |
for (int j = 0; j <= m; ++j) { | |
count += (dp[j][a] * dp[j][b]) % MOD; | |
} | |
printf("%lld", count); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment