美文网首页
2019-01-28 [HDU-2068]

2019-01-28 [HDU-2068]

作者: 林锦天 | 来源:发表于2019-01-28 11:16 被阅读0次

    include<iostream>

    using namespace std;
    long long cao(long long n,long long o)
    {
    long long sum1 = 1, sum2 = 1, sum3;
    for (long long i = o, j = n; i > 0; i--,j--)
    {
    sum1 *= i;

        sum2 *= j;
    }
     return sum2 / sum1;
    

    }

    int main()
    {
    long long n;
    while (cin >> n && n != 0)
    {
    long long c[100] = { 0,0,1 };
    for (long long i = 3; i <= 25; i++)
    c[i] = (i - 1)*(c[i - 1] + c[i - 2]);
    long long sum = 0;

        {
            for (long long i =2 ; i<(n / 2) + 1; i++)
            {
                sum += cao(n, i)*c[i];
            }
            cout << sum +1<< endl;
        }
    }
    

    }

    相关文章

      网友评论

          本文标题:2019-01-28 [HDU-2068]

          本文链接:https://www.haomeiwen.com/subject/itfajqtx.html