uva 10878 - Decode the tape 字符串水题 找到规律就简单了

来源:互联网 发布:紫外灯测量数据 编辑:程序博客网 时间:2024/05/22 08:18
#include<cstdio>#include<cstring>int main(){    #ifdef LOCAL    freopen("in.txt","r",stdin);    #endif // LOCAL    char x[15] = "___________";    char str[15];    int d[11] = {0,0,64,32,16,8,0,4,2,1,0};    int t = 0;    while(t < 2)    {        gets(str);        if(strcmp(str,x)==0){t++;continue;}        int sum = 0;        for(int i = 2;str[i]!='\0'; i++)            if(str[i] == 'o')sum += d[i];        printf("%c",sum);    }    return 0;}

原创粉丝点击