G-RPG's Wrong row.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.