标签:style blog class code tar color get int string 2014 404
#include <stdio.h> #include <string.h> const int MOD = 1000007; const int N = 505; int t, n, m, k, C[N][N]; int main() { C[0][0] = 1; for (int i = 0; i < N; i++) { C[i][0] = C[i][i] = 1; for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD; } int cas = 0; scanf("%d", &t); while (t--) { int sum = 0; scanf("%d%d%d", &n, &m, &k); for (int s = 0; s < 16; s++) { int count = 0, r = n, c = m; if (s&1) {count++; r--;} if (s&2) {count++; r--;} if (s&4) {count++, c--;} if (s&8) {count++, c--;} if (count&1) sum = (sum - C[r * c][k] + MOD) % MOD; else sum = (sum + C[r * c][k]) % MOD; } printf("Case %d: %d\n", ++cas, sum); } return 0; }
UVA 11806 - Cheerleaders(数论+容斥原理),布布扣,bubuko.com
UVA 11806 - Cheerleaders(数论+容斥原理)
标签:style blog class code tar color get int string 2014 404
原文地址:http://blog.csdn.net/accelerator_/article/details/24744683