hdu 1062 Text Reverse 字符串】的更多相关文章

Text Reverse                                                                                  Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description Ignatius likes to write words in reverse way. Given…
Problem Description Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The input contains several test cases. The first line of the inpu…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 解题报告:注意一行的末尾可能是空格,还有记得getchar()吃回车符. #include<cstdio> #include<string.h> #include<iostream> #include<algorithm> #include<cmath> #include<deque> #include<cstdlib>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 Problem Description Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The input con…
题意 : 给出你一个句子,让你把句子中每个单词的字母顺序颠倒一下输出. 思路 : 用栈即可,就是注意原来在哪儿有空格就要输出空格. //hdu1062 #include <iostream> #include <stdio.h> #include <string.h> #include <stack> using namespace std ; int main() { int n ; scanf("%d",&n) ; getch…
原题 题目大意: t组数据,每组为一行,遇到空格时讲前面的单词反转输出. 题解: 显然的栈题,遇到空格时将当前栈输出清空即可 #include<cstdio> #include<stack> #include<cstring> using namespace std; int t,l; char s[1010]; stack <char> stk; int main() { scanf("%d",&t); getchar(); w…
Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12577    Accepted Submission(s): 4743 Problem Description Ignatius likes to write words in reverse way. Given a single line of text w…
http://acm.hdu.edu.cn/showproblem.php?pid=1062 思路: 最主要的是通过getline函数存取字符串. 如何读取单个单词,并且反向输出? 用\n作为单个单词的判定. 扩展: getline函数的用法,详解 int main() { string line; while(getline(cin,line)) cout<<line<<endl; ; } 大家会发现运行时怎么也跳不出循环,甚至会发生各种莫名其妙的错误.why? getline(…
Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.   Input The input contains several test cases. The first line of the input is a single inte…
虽然这个题目一遍AC,但是心里还是忍不住骂了句shit! 花了一个小时,这个题目已经水到一定程度了,但是我却在反转这个操作上含糊不清,并且还是在采用了辅助数组的情况下,关系的理顺都如此之难. 其实我是想到了之前那次保研考试,让给数组里面的数换k位,我也是纠结好久没有写出个所以然,郁闷. #include<stdio.h> #include<string.h> #include<stdlib.h> ]; ]; void divide(char a[],int n) { ,…