您的位置:首页 > 其它

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

2013-08-02 09:24 369 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: