首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于杭电ACM 1062,该怎么解决

2012-03-23 
关于杭电ACM 1062题目要求是反转单词InputThe input contains several test cases. The first line of the

关于杭电ACM 1062
题目要求是反转单词
Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains a single line with several words. There will be at most 1000 characters in a line.

Output
For each test case, you should output the text which is processed.

Sample Input
3
olleh !dlrow
m'I morf .udh
I ekil .mca
 

Sample Output
hello world!
I'm from hdu.
I like acm.


我的程序是WA, 想到的数据都测过了,像 _ab___cc__。网上也找了AC的代码,结果一样。
高手们给我一些特殊的测试数据吧,需要的话再贴代码。

[解决办法]
这个不需要什么特殊数据啊
空格隔开的不就ok了
只要不超过1000,找几个以空格隔开的,如果ok,那就ok
[解决办法]
要说特殊的数据,个人觉得是:
1、开头或结尾处有空格
2、有连续的多个空格
3、整行都是空格
[解决办法]
if(i != ori_msg.length()-1)
ch_msg[j++] = ' ';
把这个if判断去掉,即改为:ch_msg[j++] = ' ';

加if判断后,最后一个空格填不进去

热点排行