HDU - 1062】的更多相关文章

题目链接: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…
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…
Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 51495    Accepted Submission(s): 19692 Problem Description Ignatius likes to write words in reverse way. Given a single line of text…
题意 : 给出你一个句子,让你把句子中每个单词的字母顺序颠倒一下输出. 思路 : 用栈即可,就是注意原来在哪儿有空格就要输出空格. //hdu1062 #include <iostream> #include <stdio.h> #include <string.h> #include <stack> using namespace std ; int main() { int n ; scanf("%d",&n) ; getch…
格式错误2遍:没考虑到连续两个空格的情况,遇到空格最后要输出这个空格,因为题目只需要转换单词. 另外,开cin,cout加速要注意读入不能用scanf,printf,puts,getchar这些.getline,streamstream 可以结合使用 代码: using namespace std; #define maxn 19999 #define rep(i,a,b) for(int i=(a);i<(b);i++) #define ll long long string s; strin…
昂贵的聘礼 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 44870   Accepted: 13259 Description 年 轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家拿 不出这么多金币,便请求酋长降低要求.酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币.如果你能够弄来他的水晶球,那么只要 5…
原题 题目大意: 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…
虽然这个题目一遍AC,但是心里还是忍不住骂了句shit! 花了一个小时,这个题目已经水到一定程度了,但是我却在反转这个操作上含糊不清,并且还是在采用了辅助数组的情况下,关系的理顺都如此之难. 其实我是想到了之前那次保研考试,让给数组里面的数换k位,我也是纠结好久没有写出个所以然,郁闷. #include<stdio.h> #include<string.h> #include<stdlib.h> ]; ]; void divide(char a[],int n) { ,…