设为首页 加入收藏

TOP

uva 213 - Message Decoding (我觉得我的方法要比书上少很多代码,不保证好……)
2015-07-20 18:06:08 来源: 作者: 【 】 浏览:4
Tags:uva 213 Message Decoding 觉得 方法 书上 代码 保证
#include
  
   
#include
   
     #include
    
      char s[250]; char a[10][250]; int a1[4]; int a2[250]; char ch; int init(int len) { int tt=0; for(int i=1;i<=7;i++) { for(int j=0;j<(int)pow(2,i)-1;j++) { a[i][j]=s[tt++]; if(tt>=len) break; } if(tt>=len) break; } } int tran(int *aa,int len) { int temp=0; for(int i=len-1,j=0; i>=0; i--,j++) { temp+=(int)aa[i]*pow(2,j); } return temp; } int main() { while(gets(s)!=NULL) { memset(a,0,sizeof(a)); int len=strlen(s); init(len); while(1) { int t2=0; while(t2<3) { scanf("%c",&ch); if(ch=='1'||ch=='0') { a1[t2]=ch-'0'; t2++; } } int lenth=tran(a1,3); if(lenth==0) { scanf("%c",&ch); printf("\n"); break; } while(1) { int t3=0; while(t3
     
      
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇POJ 1573 Robot Motion 搜索 下一篇Codeforces Round #257 (Div. 2)C..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: