hdu 1062(1.2.4)
来源:互联网 发布:动态面板数据举例 编辑:程序博客网 时间:2024/05/29 17:21
Text Reverse
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13281 Accepted Submission(s): 5067
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 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.
Each test case contains a single line with several words. There will be at most 1000 characters in a line.
Output
题目大意一目了然,
题目大意一目了然,
#include<stdlib.h>#include<stdio.h>#include<string.h>int main(){ int t,l,i=0,j,k; char s[1200]; scanf("%d",&t); getchar();//遇到字符读取一定要小心 while(t--) { memset(s,0,sizeof(s)); gets(s); l=strlen(s); i=0; while(i<l) { k=i; for(;s[i]!=' '&&s[i]!='\0';i++); for(j=i-1;j>=k;j--) { printf("%c",s[j]); } if(i!=l) printf(" "); i++; }printf("\n"); } return 0; }
For each test case, you should output the text which is processed.
Sample Input
3olleh !dlrowm'I morf .udhI ekil .mca
Sample Output
hello 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.
- hdu 1062(1.2.4)
- hdu 1.2.4
- HDU 1.2.4
- hdu steps 1.2.4 Buildings
- HDU 1.2.4 decimal system
- HDU 1.2.4 decimal system
- HDU 1062
- HDU 1062
- HDU 1062
- HDU-1062
- hdu 1062
- HDU 1062
- HDU 1062
- HDU-1062
- Hdu 1062
- hdu 1062
- hdu ACM step 1.2.4 hdu2399
- HDU ACM 1.2.4 hide handkerchief
- S2SH框架搭建
- jdbc获取oracle表字段相关信息
- C++ 下载网页!
- 快速幂取模算法
- Linux 环境下一些常用命令(四)
- hdu 1062(1.2.4)
- ARP报文的发送与接收(Linux下gcc编译)
- 《深入浅出 Java Concurrency》目录
- 多重背包模板解析 (二进制优化)
- 学习途中遇到的segmentation fault之二——&&与栈
- 使用MonthView控件和DTPicker控件输入日期
- getting start with storm 翻译 第六章 part-1
- poj 1011 Sticks
- hdu 4569 Special equations ( 必要条件缩小范围后暴力)