Decode the tape
输出结束是EOF,这个害我wa,水题,二进制转换为ascii
#include<stdio.h> #include<string.h> #include<math.h> int main() { int i,j; int ans=0,tes; char str[100]; while(gets(str)!=NULL) { if(!strcmp(str,"___________")) continue; tes=0; for (i=0;str[i];i++) { if(str[i]=='o') { if(i<6) tes+=pow(2,8-i); else tes+=pow(2,9-i); } } printf("%c",tes); } return 0; }