把空格看成0,把o就看成是1的話,中間的.忽略,那麼一行字符串組成的1,0串的值即位輸出字符的ASCII值
C++代碼:
#include <cstdio>
int main()
{
char s[100];
while(gets(s))
{
if(s[0]=='_')
continue;
int c=0;
for(int i=1;i<=9;++i)
{
if(s[i]==' ')
c=c*2+0;
else
{
if(s[i]=='o')
c=c*2+1;
}
}
printf("%c",c);
}
return 0;
}