Description
Corn does not participate the STEED contest, but he is interested in the word "STEED". So, Corn writes all permutations of the word "STEED" on different cards and gets 60 cards finally.
Corn sorts these cards in lexicographical order, and marks them from 1 to 60.
Now, Corn gives you a integer N (1 ≤ N ≤ 60), could you tell him the word on the Nth card?
Input
There are multiple test cases (no more than 60).
For each test case, there is one integer N (1 ≤ N ≤ 60) in a line.
Output
For each test case, you should output one line with the word on the Nth card.
Sample Input
1 2 3 4 47 48 49
Sample Output
DEEST DEETS DESET DESTE STEDE STEED TDEES
个人比较懒哟,看到只有60种情况,不想动脑筋了,直接把六十个情况列出来,也不是很久,也不会超时,真的感觉懒得可以了,哈哈
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char a[62][10];
strcpy(a[0],"DEEST");
strcpy(a[1],"DEETS");
strcpy(a[2],"DESET");
strcpy(a[3],"DESTE");
strcpy(a[4],"DETES");
strcpy(a[5],"DETSE");
strcpy(a[6],"DSEET");
strcpy(a[7],"DSETE");
strcpy(a[8],"DSTEE");
strcpy(a[9],"DTEES");
strcpy(a[10],"DTESE");
strcpy(a[11],"DTSEE");
strcpy(a[12],"EDEST");
strcpy(a[13],"EDETS");
strcpy(a[14],"EDSET");
strcpy(a[15],"EDSTE");
strcpy(a[16],"EDTES");
strcpy(a[17],"EDTSE");
strcpy(a[18],"EEDST");
strcpy(a[19],"EEDTS");
strcpy(a[20],"EESDT");
strcpy(a[21],"EESTD");
strcpy(a[22],"EETDS");
strcpy(a[23],"EETSD");
strcpy(a[24],"ESDET");
strcpy(a[25],"ESDTE");
strcpy(a[26],"ESEDT");
strcpy(a[27],"ESETD");
strcpy(a[28],"ESTDE");
strcpy(a[29],"ESTED");
strcpy(a[30],"ETDES");
strcpy(a[31],"ETDSE");
strcpy(a[32],"ETEDS");
strcpy(a[33],"ETESD");
strcpy(a[34],"ETSDE");
strcpy(a[35],"ETSED");
strcpy(a[36],"SDEET");
strcpy(a[37],"SDETE");
strcpy(a[38],"SDTEE");
strcpy(a[39],"SEDET");
strcpy(a[40],"SEDTE");
strcpy(a[41],"SEEDT");
strcpy(a[42],"SEETD");
strcpy(a[43],"SETDE");
strcpy(a[44],"SETED");
strcpy(a[45],"STDEE");
strcpy(a[46],"STEDE");
strcpy(a[47],"STEED");
strcpy(a[48],"TDEES");
strcpy(a[49],"TDESE");
strcpy(a[50],"TDSEE");
strcpy(a[51],"TEDES");
strcpy(a[52],"TEDSE");
strcpy(a[53],"TEEDS");
strcpy(a[54],"TEESD");
strcpy(a[55],"TESDE");
strcpy(a[56],"TESED");
strcpy(a[57],"TSDEE");
strcpy(a[58],"TSEDE");
strcpy(a[59],"TSEED");
int n;
while(scanf("%d",&n)!=EOF){
printf("%s\n",a[n-1]);
}
}