CDZSC_2015寒假新人(1)——基础 g
Description
Input
Each test case contains a single line with several words. There will be at most 1000 characters in a line.
Output
Sample Input
olleh !dlrow
m'I morf .udh
I ekil .mca
Sample Output
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
char a[];
int n;
scanf("%d",&n);
getchar();
while(n--)
{
gets(a);
int len=strlen(a);
int next[],m=;
for(int i=;i<=len;i++)
{
if(a[i]==' '||i==len)
{
for(int j=i-;j>=&&a[j]!=' ';j--)
{
next[m++]=j;
}
}
if(a[i]==' ')
{
next[m++]=i;
}
}
for(int i=;i<len;i++)
{
putchar(a[next[i]]);
}
printf("\n");
}
}
Hint
Remember to use getchar() to read '\n' after the interger T, then you may use gets() to read a line and process it.
CDZSC_2015寒假新人(1)——基础 g的更多相关文章
- CDZSC_2015寒假新人(2)——数学 G
G - G Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(1)——基础 e
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...
- CDZSC_2015寒假新人(1)——基础 i
Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...
- CDZSC_2015寒假新人(1)——基础 h
Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...
- CDZSC_2015寒假新人(1)——基础 f
Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...
- CDZSC_2015寒假新人(1)——基础 d
Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...
- CDZSC_2015寒假新人(1)——基础 c
Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...
- CDZSC_2015寒假新人(1)——基础 b
Description The highest building in our city has only one elevator. A request list is made up with N ...
- CDZSC_2015寒假新人(1)——基础 a
Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...
随机推荐
- win32系统信息获取
#include <Windows.h> #include "resource.h" #include <strsafe.h> PTSTR BigNumTo ...
- Java菜鸟学习笔记--面向对象篇(十五):Wrapper Class包装类
什么是包装类? 在Java里一切都是对象,除了Java中的基本数据类型(byte,short,int,long,char,float,double,boolean)不是面向对象的,这在实际使用时存在很 ...
- linux for循环
一定要记得写后面的分号:http://www.runoob.com/linux/linux-shell-variable.html 这个页面的课程的循环教程是有问题的 for color in yel ...
- inline-block样式间距
原始问题和解决方法请参考 淘宝UED官方博客:inline-block 前世今生 布局时采用行内块display:inline-block,发现元素之间有空隙,原因是由于空白字符引起的,详细见上面链接 ...
- WordPress nginx环境下开启多站点
在wp-config.php插入 define('WP_ALLOW_MULTISITE', true); 进入管理页面安装网络,子目录模式按提示再在wp-config.php插入 define('MU ...
- PHP原始的数据库操作
<?php //这是一个工具类;作用是完成对数据库的操作; class SqlHelper{ public $conn; public $dbname=& ...
- django-filter 使用Filter来筛选你的数据
django-filter Django-filter is a generic, reusable application to alleviate writing some of the more ...
- css 完美替换图片
1.css替换简单图标的展示方法 ;display:inline-block;position:absolute;left:11px;top:10px;border-right:6px solid t ...
- commons.fileupload简单应用
导入包: commons-fileupload-1.3.1.jar commons-io-2.4.jar commons-fileupload依赖于commons-io,commons-io-2.4必 ...
- 关于NGINX变量的一些测试结果
作为NGINX变量,不像正规语言那么正式. 但处理自定义和内部变量时,这些操作,也是少不了的. geo $dollar { default "$"; } server { list ...