#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair P; typedef pair Ps; const ll INF=1e9; bool comp(string x, string y){ if(x[0]!=y[0]) return x[0]>y[0]; Ps xp, yp; if(x.size()==1) xp=Ps(x+x, 1); else xp=Ps(x, 2); if(y.size()==1) yp=Ps(y+y, 1); else yp=Ps(y, 2); return xp>yp; } int k; string b[100]; int ct[10]; ll comb[201][201]; set st; void zentan(int p){ st.clear(); int c=0; sort(b, b+p, comp); int ind[100]; ind[0]=0; string b2[100]; b[0]=b2[0]; for(int i=1; i>n>>k; string a[100]; for(int i=0; i>a[i]; } sort(a, a+n, comp); if(k==1){ for(int i=0; i=k){ for(int j=n-1-i; j=k){ auto itr=st.end(); itr--; string s; for(int l=0; l