题意:长度为n的序列,相邻两个或单独一个可以划分到一个组,每个元素最多处于一个组. 问恰好分割成k(1<=k<=m)段有多少种方案? 标程: #include<bits/stdc++.h> using namespace std; typedef long long ll; ; ; ; int l,_n,pos[N],n,k,a[N],b[N],c[N],x1[N],x2[N],x3[N],x4[N],w[N],wn,inv_n; int ksm(int x,int y) { ;…
Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls share the same label. The labeling satisfies several constrains like "The ball labeled with a is lighter…