#include #include #include #include #include using namespace std; const int maxN=305; const int maxM=35; typedef double db; const db eps=1e-12; db dp[maxN][maxM]; int pre[maxN][maxM]; db cur[maxM][maxM]; db Prev[maxM][maxM]; int shot[500],N; int inv[maxM]; int main() { int T;scanf("%d",&T); while(T--) { scanf("%d",&N); memset(shot,-1,sizeof(shot)); for(int i=0;idp[i+1][k]) { pre[i+1][k]=j; dp[i+1][k]=tmp; } } } } db maxx=-1e200; int idx=-1; for(int i=0;imaxx) { maxx=dp[l][i]; idx=i; } } int ans[500]; int mm=l; while(mm) { ans[mm]=idx; idx=pre[mm][idx]; mm--; } for(int i=1;i<=l;++i) printf("%c",inv[ans[i]]); printf("\n"); } } }