每种水的生成函数

第1种: 1+x+x2+=11x
第2种: 1+x=1x21x
第3种: 1+x+x2+x3+x4=1x51x
第4种: 1+x5+x10+=11x5
第5种: 1+x2+x4+=11x2

乘在一起得到: 1(1x)3=(1x)3
带入广义二项式定理得: f(x)=i=0Ci+2ixi
i=n时第n项为 xCn+2nxn=Cn+22xn
所以答案就为ans=(n+1)(n+2)2

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(void)
{
int n;
scanf("%d",&n);
printf("%lld\n",1LL*(n+1)*(n+2)/2);
return 0;
}