标签:out define using amp 编号 pre clu cstring linker
题意:2k个点两两相连(共k条线),将圆分成最少的块的方案数?
卡特兰数经典问题。一开始没想到第一条线能与所有偶数编号的点相连,以至于认为是2^(k-1)。用catalan(n)=catalan(n-1)*(4*n-2)/(n+1)先记录。
#pragma comment(linker,"/STACK:1024000000,1024000000") #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <iomanip> #include <cstring> #include <map> #include <queue> #include <set> #include <cassert> #include <list> #define mkp make_pair using namespace std; const double EPS=1e-8; const int SZ=33,INF=0x7FFFFFFF; const long long mod=19999997; typedef long long lon; lon arr[SZ]; void init() { arr[1]=1; for(lon i=2;i<SZ;++i)arr[i]=arr[i-1]*(4*i-2)/(i+1); } int main() { std::ios::sync_with_stdio(0); //freopen("d:\\1.txt","r",stdin); lon casenum; //cin>>casenum; //scanf("%d",&casenum); //for(lon time=1;time<=casenum;++time) //for(lon time=1;cin>>n;++time) { init(); lon n; cin>>n; cout<<arr[n]<<" "<<n+1<<endl; } return 0; }
标签:out define using amp 编号 pre clu cstring linker
原文地址:https://www.cnblogs.com/gaudar/p/9765269.html