`
java-mans
  • 浏览: 11435150 次
文章分类
社区版块
存档分类
最新评论

10878 - Decode the tape

 
阅读更多
#include <stdio.h>
#include <string.h>
int main()
{
	//freopen("data.in","r",stdin);
	//freopen("data.out","w",stdout);
	char ch[1000];
	gets(ch);
	while(gets(ch)&&strcmp(ch,"___________"))
	{
		int len=strlen(ch);
		char num,j;
		num=0;
		j=1;
		for(int i=len-2;i>=1;i--)
		{
			if(ch[i]=='o')
			{
				num+=j;
				j*=2;
			}
			else if(ch[i]==' ')
			{
				j*=2;
			}
		}
		printf("%c",num);
	}
	return 0;
}


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics