1062 字符串处理 水题
来源:互联网 发布:编程常用语言有哪些 编辑:程序博客网 时间:2024/05/22 02:24
Hot~~欢迎“信息学(OI)选手”——报考杭州电子科技大学!Text ReverseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25889 Accepted Submission(s): 10041Problem DescriptionIgnatius 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.InputThe 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.OutputFor each test case, you should output the text which is processed.Sample Input3olleh !dlrowm'I morf .udhI ekil .mcaSample Outputhello world!I'm from hdu.I like acm.HintRemember to use getchar() to read '\n' after the interger T, then you may use gets() to read a line and process it.AuthorIgnatius.LRecommend
#include<stdio.h>#include<string.h>char c[1001];void print(int n){ for(int i=1;i<=n;i++) { gets(c);//puts(c); int len=strlen(c); for(int i=0;i<len;i++) { if(c[i]==' ') { for(int j=i-1;c[j]!=' '&&j>=0;j--) putchar(c[j]); putchar(' '); } if(i==len-1) for(int j=i;c[j]!=' '&&j>=0;j--) putchar(c[j]); } putchar('\n'); }}int main(void){ //freopen("E:\\test.txt","r",stdin); int n; while(~scanf("%d",&n)) { getchar(); print(n); } return 0;}
0 0
- 1062 字符串处理 水题
- HDU 1062 Text Reverse 水题 字符串处理
- hdu 1062 字符串处理
- hdu 1062 字符串处理
- Hduoj2072 【水题】【字符串处理】
- hdu2072 字符串处理 模拟 水题
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 字符串处理
- 处理字符串
- 字符串处理
- hdu 2136 素数打表
- 第十五周(3)-阅读程序
- 学习笔记2__布局:固定顶栏布局
- 2021 贪心算法 (最优转载问题)水题
- 01背包
- 1062 字符串处理 水题
- C语言使用非递归和递归函数分别实现阶乘,斐波那契,最大公约数
- Thymeleaf基础知识
- InputStreamReader
- 2055 签到题
- ParNew 和 Parallel Old
- 丑数
- 网桥与交换机的区别
- 2054 大数模拟 水题(略坑)