hdu Text Reverse
2015-10-12 09:59
274 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062
单词翻转!
代码:
单词翻转!
代码:
#include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> #include <iostream> #include <ctype.h> #include <iomanip> #include <queue> #include <stdlib.h> using namespace std; int main() { int n; char a[1000]; while(~scanf("%d",&n)){ getchar(); while(n--){ gets(a); int m=strlen(a); int k=0,t=0,j,i; for(i=0; i<=m; i++) { if(a[i]==' '||a[i]=='\0') { k=i; for(j=k-1; j>=t; j--) { printf("%c",a[j]); } t=k+1; if(a[i]==' ') printf(" "); } } printf("\n"); } } return 0; }
相关文章推荐
- RAC中一次ORA-00845的解决
- java String转bigdecimal 精确两位小数点然后对转的数进行算法计算。
- 硅谷悄然而起的流行:在管理上干掉CEO!
- maven的安装与环境变量配置
- 用empty()来代替检查size()是否为空
- shell日常案例(一)
- Java基础知识强化之IO流笔记54:IO流练习之 LineNumberReader的特有的功能使用
- 数据库分类----业务应用层面
- 局域网机器访问不了主机虚拟机Linux的Web工程
- js实现div拖拽(top、left定位)
- 一个很好的博客
- web 服务负载、基本优化架构
- FineReport——JS二次开发(局部刷新)
- CyclicBarrier的介绍和使用
- Oracle常用的命令
- Centos安装eclipse
- 用 Maven 运行 MyBatis Generator(Running MyBatis Generator With Maven)《IT蓝豹》
- 【投稿】使用CALayer的Mask实现注水动画效果
- [国嵌笔记][001-003][嵌入式系统概述]
- hdu Online Judge