STEED Cards(打表 金马五校赛-东华大学)

本文介绍了一个关于单词“STEED”所有可能排列的问题,并通过编程的方式解决了如何获取这些排列并按字典序排序的问题。文章提供了一个完整的C++程序示例,该程序能够根据输入的整数N返回“STEED”的第N个排列。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem A : STEED Cards


<a type="button" class="btn btn-default" href="/solution/submit.html?problemId=5284">Submit</a> (Out of Contest)

Time Limit: 1 s

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

 


Author: Corn


#include<iostream>
#include<cstdio>
using namespace std;
 
char s[60][6]={"DEEST","DEETS","DESET","DESTE","DETES",
"DETSE","DSEET","DSETE","DSTEE","DTEES","DTESE","DTSEE","EDEST",
"EDETS","EDSET","EDSTE","EDTES","EDTSE","EEDST","EEDTS","EESDT","EESTD",
"EETDS","EETSD","ESDET","ESDTE","ESEDT","ESETD","ESTDE","ESTED","ETDES","ETDSE",
"ETEDS","ETESD","ETSDE","ETSED","SDEET","SDETE","SDTEE","SEDET","SEDTE",
"SEEDT","SEETD","SETDE","SETED","STDEE","STEDE","STEED","TDEES","TDESE",
"TDSEE","TEDES","TEDSE","TEEDS","TEESD","TESDE","TESED","TSDEE","TSEDE","TSEED"
};
int main()
{
    int n;
    while(cin>>n){
        cout<<s[n-1]<<endl; 
    }
    return 0;
} 





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值