题解报告:hdu 1062 Text Reverse

Posted 霜雪千年

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了题解报告:hdu 1062 Text Reverse相关的知识,希望对你有一定的参考价值。

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062

解题思路:问题求解的是单词的反转。。。

AC代码:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 char a[1005];
 4 int main()
 5 {
 6     int T,len,x,y;
 7     while(cin>>T){
 8         getchar();//吃掉回车符
 9         while(T--){
10             gets(a);
11             len=strlen(a);
12             for(int i=0;i<len;++i){
13                 x=i;//标记当前单词的起始坐标
14                 while(a[i]!=  && a[i]!=\0)++i;//循环直到遇到空字符
15                 y=i-1;//标记单词尾
16                 for(int j=y;j>=x;--j)
17                     printf("%c",a[j]);//反序输出
18                 if(a[i]== )cout<< ;//如果此时a[i]是空字符的haul顺便输出
19             }
20             cout<<endl;//换行
21         }
22     }
23     return 0;
24 }

 

以上是关于题解报告:hdu 1062 Text Reverse的主要内容,如果未能解决你的问题,请参考以下文章

hdu1062 Text Reverse

hdu1062 text reverse

Hdu 1062 Text Reverse

HDU 1062 Text Reverse

HDU 1062 Text Reverse

HDOJ/HDU 1062 Text Reverse(字符串翻转~)