题目:http://acm.hdu.edu.cn/showproblem.php?pid=2719
AC代码(C++):
#include <iostream> #include <queue> #include <set> #include <string> #include <algorithm> #include <string.h> #include <math.h> #define INF 0x3f3f3f3f #define eps 1e-8 using namespace std; int main() { char str[80]; while (cin.getline(str, 80)) { if (str[0] == '#')break; for (int i = 0; str[i] != '\0'; i++) { switch (str[i]) { case ' ': cout << "%20"; break; case '!': cout << "%21"; break; case '$': cout << "%24"; break; case '%': cout << "%25"; break; case '(': cout << "%28"; break; case ')': cout << "%29"; break; case '*': cout << "%2a"; break; default: cout << str[i]; break; } } cout << endl; } //system("pause"); }总结: 水题.