问题标题: 字符串解密

0
0
已解决
李泽远
李泽远
高级天翼
高级天翼

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    getline(cin,a);
    for(int i=0;i<a.size();i++)
    {
  if(a[i]=='4'&&a[i+1]=='6')
            a.replace(i,1,".");
        if(a[i]=='6'&&a[i+1]=='3')
            a.replace(i,1,"?");
        if(a[i]=='3'&&a[i+1]=='3')
            a.replace(i,1,"!");
        if(a[i]=='9'&&a[i+1]=='7')
            a.replace(i,2,"a");
        if(a[i]=='9'&&a[i+1]=='8')
            a.replace(i,2,"b");
        if(a[i]=='9'&&a[i+1]=='9')
            a.replace(i,2,"c");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='0')
            a.replace(i,3,"d");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='1')
            a.replace(i,3,"e");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='2')
            a.replace(i,3,"f");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='3')
            a.replace(i,3,"g");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='4')
            a.replace(i,3,"h");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='5')
            a.replace(i,3,"i");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='6')
            a.replace(i,3,"j");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='7')
            a.replace(i,3,"k");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='8')
            a.replace(i,3,"l");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='9')
            a.replace(i,3,"m");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='0')
            a.replace(i,3,"n");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='1')
            a.replace(i,3,"o");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='2')
            a.replace(i,3,"p");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='3')
            a.replace(i,3,"q");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='4')
            a.replace(i,3,"r");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='5')
            a.replace(i,3,"s");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='6')
            a.replace(i,3,"t");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='7')
            a.replace(i,3,"u");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='8')
            a.replace(i,3,"v");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='9')
            a.replace(i,3,"w");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='0')
            a.replace(i,3,"x");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='1')
            a.replace(i,3,"y");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='2')
            a.replace(i,3,"z");
    }
    for(int i=0;i<a.size();i++)
    {
  if(a[i]>='0'&&a[i]<='9')
   a.erase(i,1);
 }   
    a[0]-=32;
    cout<<a;
    //105 108111118101 9910410511097 我爱中国(英文)
    //11910497116 101118101114 自己试
    //121111117 97114101 97 100111103
    return 0;
}

字符串解密,每打完一个单词要加空格哦。

我之前也发过这个。。。

麻烦各位复制粘贴也要留言一下!

李泽远在2019-08-11 09:54:49追加了内容

根据ASCLL码写的。

每个单词的字母ASCLL码要连起来,但打完一个单词要打空格。

比如:

105(i)     (空格)    108(l)111(o)118(v)101(e)     (空格)    99(c)104(h)105(i)110(n)97(a)33(!)

还有一件事!

每个单词的字母ASCLL码要连起来,但打完一个单词要打空格。

还有一件事!

只能是小写字母,不过自动首字母大写。

还有一件事!

别忘了:46.(句点);63(?);33(!);


0
已采纳
陶旭杰
陶旭杰
中级光能
中级光能

666,大佬啊!

只是不知道揭秘机制是什么,求公布!

121111117 97114101 97 100111103 = You are a dog

怎么感觉被坑了。。。

总之,这个字符串解密非常牛皮,至少像我这个蒟蒻破解不出来!

 

0
0
0
李泽远
李泽远
高级天翼
高级天翼

新加了1.0(更难破译,把需要手动打的空格改成了32):

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    getline(cin,a);
    for(int i=0;i<a.size();i++)
    {
  if(a[i]=='4'&&a[i+1]=='6')
            a.replace(i,2,".");
        if(a[i]=='6'&&a[i+1]=='3')
            a.replace(i,2,"?");
        if(a[i]=='3'&&a[i+1]=='3')
            a.replace(i,2,"!");
        if(a[i]=='3'&&a[i+1]=='2')
            a.replace(i,2," ");
        if(a[i]=='9'&&a[i+1]=='7')
            a.replace(i,2,"a");
        if(a[i]=='9'&&a[i+1]=='8')
            a.replace(i,2,"b");
        if(a[i]=='9'&&a[i+1]=='9')
            a.replace(i,2,"c");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='0')
            a.replace(i,3,"d");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='1')
            a.replace(i,3,"e");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='2')
            a.replace(i,3,"f");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='3')
            a.replace(i,3,"g");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='4')
            a.replace(i,3,"h");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='5')
            a.replace(i,3,"i");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='6')
            a.replace(i,3,"j");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='7')
            a.replace(i,3,"k");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='8')
            a.replace(i,3,"l");
        if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='9')
            a.replace(i,3,"m");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='0')
            a.replace(i,3,"n");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='1')
            a.replace(i,3,"o");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='2')
            a.replace(i,3,"p");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='3')
            a.replace(i,3,"q");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='4')
            a.replace(i,3,"r");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='5')
            a.replace(i,3,"s");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='6')
            a.replace(i,3,"t");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='7')
            a.replace(i,3,"u");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='8')
            a.replace(i,3,"v");
        if(a[i]=='1'&&a[i+1]=='1'&&a[i+2]=='9')
            a.replace(i,3,"w");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='0')
            a.replace(i,3,"x");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='1')
            a.replace(i,3,"y");
        if(a[i]=='1'&&a[i+1]=='2'&&a[i+2]=='2')
            a.replace(i,3,"z");
    }
    a[0]-=32;
    cout<<a;
    return 0;
}

0
0
我要回答