Description
This summer, Hangzhou Electric ACM Training Team first formed a female team, including a team called RPG, but as one of the training team members of the wild camel unexpectedly do not know RPG three person specifically who. RPG gave him the chance to let him guess, the first guess: R is the princess, p is the grass, G is the Moon hare; the second guess: R is grass, p is the Moon hare, G is the princess; Third guess: R is grass, p is princess, G is moon Hare; The poor wild camel finally divided the RPG for the sixth time. Because of the drive of the RPG, more and more women to do ACM, our wild camel want to know them, but now there are n many people, he has to guess the number of times, in order not to embarrass the wild camel, girls only ask him to correct half or above even if the clearance, how many groups of answers can make him smooth clearance.
Input
There are multiple case entries in the input data, each case containing an n, representing a few girls, (n<=25), n = 0 input end.
Sample Input
1 2 0
Sample Output
1 1 Classic Wrong row problem, all right, wrong one, wrong two ... Wrong N/2, all the wrong row number add sourcehttp://acm.hust.edu.cn/vjudge/contest/view.action?cid=89340#problem/g
#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 <=; 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);} }
G-RPG's Wrong row.