标签:
Description
Input
Sample Input
Sample Output
#include <stdio.h> __int64 C(int n, int m) { __int64 ans = 1, temp = 1; for(int i = 1; i <= m; i++) { ans *= (n - i + 1); temp *= i; } return ans / temp; } int main() { __int64 n, a[14]; a[1] = 0; a[2] = 1; for(int i = 3; i <= 13; i++) { a[i] = (i - 1) * (a[i-2] + a[i-1]); } while(scanf("%I64d", &n), n) { __int64 ans = 1; for(int i = 2; i <= n / 2; i++) ans += C(n, i) * a[i]; printf("%I64d\n", ans); } }
标签:
原文地址:http://www.cnblogs.com/rain-1/p/4757795.html