【HDOJ】2707 Steganography

简单字符串,读懂题,很容易AC。

 #include <stdio.h>
#include <string.h> char buf[], line[], des[]; int main() {
int i, k, tmp, len;
int ib, id; memset(buf, , sizeof(buf));
ib = ; while (gets(line) != NULL) {
len = strlen(line);
if (len== && line[]=='#')
break;
if (len== && line[]=='*') {
id = ;
for (i=; i<ib; i+=) {
tmp = (buf[i]<<) + (buf[i+]<<) + (buf[i+]<<) + (buf[i+]<<) + (buf[i+]);
if (tmp == )
des[id] = ' ';
else if (tmp == )
des[id] = '\'';
else if (tmp == )
des[id] = ',';
else if (tmp == )
des[id] = '-';
else if (tmp == )
des[id] = '.';
else if (tmp == )
des[id] = '?';
else
des[id] = tmp-+'A';
++id;
}
des[id] = '\0';
printf("%s\n", des);
ib = ;
memset(buf, , sizeof(buf));
} else {
k = ;
for (i=; i<len; ++i) {
if (k && line[i]!=' ') {
buf[ib++] = !(k&);
k = ;
} else if (line[i] == ' '){
++k;
}
}
}
} return ;
}
上一篇:JavaScript基础--小案例:在网页指定位置弹出错误信息(十二)


下一篇:Fundebug微信小程序错误监控插件更新至1.1.0,新增test()与notifyHttpError()方法