1#include<iostream> 2#include<string> 3using namespace std; 4char in[15]; 5char ans1[15]; 6int main() 7{ 8 int ans; 9 int i,j,k,len; 10 while(cin>>in) 11 { 12 if(in[0]=='0') 13 break; 14 strcpy(ans1,in); 15 len=strlen(in); 16 for(i=0;i<len;i++) 17 { 18 if(in[i]>='4') 19 in[i]--; 20 } 21 ans=0; 22 k=1; 23 for(i=len-1;i>=0;i--) 24 { 25 ans+=(in[i]-'0')*k; 26 k*=9; 27 } 28 cout<<ans1<<": "<<ans<<endl; 29 } 30 return 0; 31}
|