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. JDBC的使用(二):PreparedStatement接口;ResultSet接口(获取结果集);例题:SQL注入

    ResultSet接口:类似于一个临时表,用来暂时存放数据库查询操作所获得的结果集. getInt(), getFloat(), getDate(), getBoolean(), getString( ...

  2. jquery in confluence.

    https://confluence.atlassian.com/confkb/how-to-use-javascript-in-confluence-313458839.html https://a ...

  3. 使用jspatch进行热修复的实战总结

    最近正式在线上项目中集成了jspatch进行热修复,这里做一个简单的总结. 工具篇: 首先,用xcode来编辑js非常困难,基本上没有缩进,完全需要手写:经过研究发现使用 Sublime text3 ...

  4. 转摘 MySQL扫盲篇

    一下文章摘自:http://www.jellythink.com/archives/636 MySQL扫盲篇 2014-09-15 分类:MySQL / 数据库 阅读(1412) 评论(1)  为什么 ...

  5. JavaScript编码规范指南

    前言 本文摘自Google JavaScript编码规范指南,截取了其中比较容易理解与遵循的点作为团队的JavaScript编码规范. JavaScript 语言规范 变量 声明变量必须加上 var  ...

  6. Android studio 出现 Unsupported major.minor version 52.0

    参考资料:http://blog.csdn.net/fakine/article/details/51241202 最近更新了Android studio 之后,出现了Error:java.lang. ...

  7. 自定义EL表达式的函数

    编写描述的tld文件放到web-inf/目录下,才能在jsp页面上调用 <?xml version="1.0" encoding="UTF-8" ?> ...

  8. jQuery 菜单

  9. Eclipse版本android 65535解决方案(原理等同android studio现在的分包方式)

    由于工作的需要看了下Eclipse下android65535的解决方案,查了好多文档,真心的发自内心的说一句请不要再拷贝别人的博客了,害人,真害人. 接下来我说下我的实现方式,首先说下65535的最可 ...

  10. 【皇甫】☀初识AOP

    新知识,新起点,下面介绍一下aop所要准备架包和各个层 特点: 创建好的各个层: 所需架包: 具体步骤: No.1  搭建分层架构 entity 1 public class User impleme ...