摘要:
#include int main() { int width, height; int i, j; while (~scanf("%d %d", &width, &height)) { if (width != 0 && height != 0) { printf("+"); for (i = 0; ... 阅读全文
摘要:
#include int a[1000] = { 0 }; int main() { int m; int i, j = 0; while (~scanf("%d", &m)) { while (m) { a[j++] = m % 2; m = m / 2; } for (i ... 阅读全文
摘要:
/* 思路:有n位新郎,但是又m位新郎会找错,那么有n-m位新郎会找对,而找对的n-m位新郎的找发就是在 n位新郎中随机找n-m位有多少种排列组合公式有n!/(m!*(n-m!)),而另外找错的新郎则按照错排公式来做 D(n)=(n-1)*(D(n-1)+D(n-2)) */ #include long long p[25] = { 1,1,0,0 }; long long q[2... 阅读全文
摘要:
#include long long a[22] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }; long long b[22] = { 0 }; long long jiecheng(int n) { if (b[n]>0) { return b[n]; } ... 阅读全文