关注
#include <iostream>
#include <set>
using namespace std;
string instr;
void decrypt(int ith, string nowstr, set<string> &v)
{
if(ith >= instr.size())
{
v.insert(nowstr);
return;
}
int num;
for(int i = 1; i <= 2; i++)
{
if(instr[ith] == '0')
break;
if(i == 1)
num = instr[ith] - '0';
else
{
if(ith >= (instr.size() - 1))
break;
num = (instr[ith] - '0') * 10 + (instr[ith + 1] - '0');
if(num > 26)
break;
}
char temp = 'a' + (num - 1);
decrypt(ith + i, nowstr + temp, v);
}
}
int main()
{
while(cin >> instr)
{
set<string> result;
decrypt(0, "", result);
set<string>::iterator it;
for(it = result.begin(); it != result.end(); it++) {
if(it != result.begin())
cout << ' ';
cout << *it;
}
cout << endl;
}
return 0;
} 这是我ac了的代码,毕竟考试写的,可读性绝对是差,你可以看看错哪了……看不明白可以问我……
查看原帖
点赞 评论
相关推荐
牛客热帖
更多
正在热议
更多
# 在大厂上班是一种什么样的体验 #
12756次浏览 173人参与
# 你的mentor是什么样的人? #
51259次浏览 724人参与
# 程序员找工作至少要刷多少题? #
21675次浏览 278人参与
# 我和mentor的爱恨情仇 #
106370次浏览 951人参与
# 论秋招对个人心气的改变 #
13898次浏览 193人参与
# 机械人避雷的岗位/公司 #
44300次浏览 311人参与
# 为了减少AI幻觉,你注入过哪些设定? #
6356次浏览 185人参与
# 秋招落幕,你是He or Be #
54341次浏览 618人参与
# 校招第一份工作你干了多久? #
136725次浏览 597人参与
# 高薪高压 vs 低薪wlb,你怎么选? #
47512次浏览 291人参与
# 设计人如何选offer #
189791次浏览 868人参与
# 考公VS就业,你怎么选? #
92031次浏览 507人参与
# 职场上哪些行为很加分? #
322718次浏览 3604人参与
# 你的秋招进行到哪一步了 #
2531713次浏览 23253人参与
# 牛客AI体验站 #
8049次浏览 213人参与
# 机械人还在等华为开奖吗? #
312271次浏览 1582人参与
# 秋招投递记录 #
381063次浏览 3204人参与
# 12306一秒售罄,你抢到回家的票了吗? #
2385次浏览 52人参与
# 我现在比当时_,你想录用我吗 #
9631次浏览 131人参与
# 重来一次,我还会选择这个专业吗 #
411450次浏览 3898人参与
