10878 - Decode the tape

来源:互联网 发布:平面设计书籍 知乎 编辑:程序博客网 时间:2024/04/27 06:06
#include <iostream>#include <cstring>#include <cstdio>using namespace std;int main(){    char str[15];    char c;    memset(str,0,sizeof(str));    while(gets(str))    {        c=0;        if(str[2]=='o')            c+=64;        if(str[3]=='o')            c+=32;        if(str[4]=='o')            c+=16;        if(str[5]=='o')            c+=8;        if(str[7]=='o')            c+=4;        if(str[8]=='o')            c+=2;        if(str[9]=='o')            c+=1;        if(c!=0)        cout<<c;        memset(str,0,sizeof(str));    }    return 0;}

原创粉丝点击