📄 decode.txt
字号:
//以解码bill~gates为例子
//输入概率为0.1463722915
#include <iostream>
using namespace std;
main()
{
long double I[9][2]={{0,0.1},{0.1,0.2},{0.2,0.3},{0.3,0.4},{0.4,0.5},{0.5,0.7},{0.7,0.8},{0.8,0.9},{0.9,1.0}};
char element[9]={'a','b','e','g','i','l','t','s','.'};
long double L=0,b;
int cnt=0,a;
long double H=1,length=1.0,ltemp,temp;
char flag[10];
int j,i;
cout<<"please input the nember to be decoded:"<<endl;
cin>>b;
while(cnt<10)
{ temp=(b-L)/length;
for(j=0;j<10;j++)
{
if(I[j][0]<temp&&I[j][1]>temp)
{ flag[cnt++]=element[j];
a=j;
}
}
ltemp=L;
L+=length*I[a][0];
H=ltemp+length*I[a][1];
length=H-L;
}
cout<<"\n the decoded the nembers are as following:\n";
for(i=0;i<10;i++)
cout<<flag[i]<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -