题目:http://acm.hdu.edu.cn/showproblem.php?pid=2564
AC代码(C++):
#include <iostream> #include <queue> #include <string> #include <algorithm> #include <math.h> #define INF 0x3f3f3f3f #define eps 1e-8 using namespace std; int main() { int t; cin >> t; char str[120]; getchar(); while (t--) { cin.getline(str, 120); bool flag = true; for (int i = 0; str[i] != '\0'; i++) { if (flag&&str[i] != ' ') { char tmp = str[i]; if (str[i] >= 'a'&&str[i] <= 'z')tmp += 'A' - 'a'; cout << tmp; flag = false; } else if (str[i] == ' ')flag = true; } cout << endl; } //system("pause"); }总结: 水题.