?? decode.txt
字號(hào):
//以解碼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;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -