Reversed Words

Time Limit: 2000MS Memory limit: 131072K

题目描述

Some aliens are learning English. They have a very strange way in writing that they revered every word in the sentence but keep all the words in common order. For example when they want to write “one two three”, they will write down “eno owt eerht”.

Now we’ve got some sentence written by these aliens, translate them! And maybe we will know some of their secrets!

输入

 Multiple test cases. The first line contains a positive integer T (T <= 1000), indicating the number of test cases.

For each test cases, there will be one line contains only lower case letters and spaces. The length of each line will be no more than 10000. Test cases which are longer than 5000 will be less than 50. Continuous letters are seen as a word, words are separated
by spaces. There won’t be two adjacent spaces in the input. Space won’t be the first or the last character.

输出

 One line per case, the translated sentence.

示例输入

2
eno owt eerhtabcde

示例输出

one two threeedcba

来源

  “浪潮杯”山东省第七届ACM大学生程序设计竞赛

题意

不需要看题目,直接看样例便可以知道题目的意思啦~

一个必须1A的题目

AC代码:
#include"stdio.h"
#include"string.h"
#include<iostream>
using namespace std;
char c[10005];
int main()
{
    int n;
    cin>>n;
    getchar();
    while(n--)
    {
        gets(c);
        for(int i=0;i<(int)strlen(c);i++)
        {
            if(c[i]==' ')
            {
                for(int j=i-1;j>=0&&c[j]!=' ';j--)
                    putchar(c[j]);
                putchar(' ');
            }
        }
        for(int i=strlen(c)-1;i>=0&&c[i]!=' ';i--)
            putchar(c[i]);
        printf("\n");
    }
    return 0;
}  

山东省第七届ACM省赛------Reversed Words的更多相关文章

  1. 山东省第七届ACM省赛------Memory Leak

    Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...

  2. 山东省第七届ACM省赛------Triple Nim

    Triple Nim Time Limit: 2000MS Memory limit: 65536K 题目描述 Alice and Bob are always playing all kinds o ...

  3. 山东省第七届ACM省赛------The Binding of Isaac

    The Binding of Isaac Time Limit: 2000MS Memory limit: 65536K 题目描述 Ok, now I will introduce this game ...

  4. 山东省第七届ACM省赛------Fibonacci

    Fibonacci Time Limit: 2000MS Memory limit: 131072K 题目描述 Fibonacci numbers are well-known as follow: ...

  5. 山东省第七届ACM省赛------Julyed

    Julyed Time Limit: 2000MS Memory limit: 65536K 题目描述 Julyed is preparing for her CET-6. She has N wor ...

  6. 山东省第七届ACM省赛

    ID Title Hint A Julyed 无 B Fibonacci 打表 C Proxy 最短路径 D Swiss-system tournament 归并排序 E The Binding of ...

  7. 山东省第十届ACM省赛参赛后的学期总结

    5.11,5.12两天的济南之旅结束了,我也参加了人生中第一次正式的acm比赛,虽然是以友情队的身份,但是我依旧十分兴奋. 其实一直想写博客来增加自己的能力的,但是一直拖到现在,正赶上老师要求写一份总 ...

  8. Rectangles(第七届ACM省赛原题+最长上升子序列)

    题目链接: http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=1255 描述 Given N (4 <= N <= 100)  rec ...

  9. 山东理工大学第七届ACM校赛-LCM的个数 分类: 比赛 2015-06-26 10:37 18人阅读 评论(0) 收藏

    LCM的个数 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 对于我们来说求两个数的LCM(最小公倍数)是很容易的事,现在我遇到了 ...

随机推荐

  1. angular $scope对象

    $scope是一个pojo对象 $scope提供了一些工具方法.例如:$watch() $apply(),一般不会手工去调用 $scope是表达式的执行环境也叫作用域 $scope是一个树形结构,与D ...

  2. 解决mysql数据库插入中文字段时出现??? 的问题

    1.检查并修改mysql的my.ini的配置文件   default-character-set=utf8 2.建立数据库是要指定字符集   create database mydb default ...

  3. winsock error 相关

    10061-WSAECONNREFUSED 是指没有启动服务器或者说服务器没有处于监听状态.通常导致client在connect时候返回这个错误码的原因在于服务端与客户端设置的端口号没有同步转换导致( ...

  4. xcode8升级后问题总汇

    一.注释快捷键无法使用 command + / 快捷键无法使用,在终端执行以下命令,然后重启Xcode即可.   1 sudo /usr/libexec/xpccachectl 二.注释快捷键 Xco ...

  5. MongoDB的安装和配置成服务的三种方法和一些难点

    1. Hotfix KB2731284 or later update is not installed的问题: If you are running any edition of Windows S ...

  6. spark 源码安装

    clone 源码 git clone git://github.com/apache/spark.git maven编译源码 国外镜像比较慢,此处修改maven仓库的镜像为阿里云镜像: <mir ...

  7. VS2015 + Cordova Html5开发使用Crosswalk Web引擎

    CrossWalk引擎的好处是统一不同android设备的Html5的差异性,据说速度很快. Vs2015中使用非常简单,作为一个Apache Cordova的插件安装即可: Installing t ...

  8. git用.gitignore忽略指定文件

    .gitignore 配置文件用于配置不需要加入版本管理的文件,配置好该文件可以为我们的版本管理带来很大的便利,以下是个人对于配置 .gitignore 的一些心得. 1.配置语法: 以斜杠“/”开头 ...

  9. 【C#进阶】override new virtual

    class Organ { public virtual void Intro() { Console.WriteLine("I'm a organ."); } public st ...

  10. 【js跨域】js实现跨域访问的几种方式

    这里说的js跨域是指通过js在不同的域之间进行数据传输或通信,比如用ajax向一个不同的域请求数据,或者通过js获取页面中不同域的框架中(iframe)的数据.只要协议.域名.端口有任何一个不同,都被 ...