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. [dpdk] 熟悉SDK与初步使用 (二)(skeleton源码分析)

    接续前节:[dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境) 程序逻辑: 运行参数: 关键API: 入口函数: int rte_eal_init(int argc, char **ar ...

  2. Python 打包工具cx_freeze 问题记录及解决办法

    在节前的最后一天,解决了打包过程中遇到的所有问题,可以成功运行了!真是个好彩头,希望新的一年一切顺利! 以下是在使用cx_freeze过程中遇到的问题及解决办法(Win7) 问题描述:运行exe,启动 ...

  3. 《Linux及安全》实践3.2

    Login程序破解 一.掌握基本的汇编指令机器码 nop=空指令( 机器码90) JNE = 如果不相等就跳转机器码75) JE = 如果相等就跳转机器码74) JMP = 无条件跳转机器码EB) C ...

  4. JMeter学习-026-JMeter 分布式(远程)参数化测试实例

    以前文所述对文章详情的HTTP请求进行性能测试为例.日常实际场景中,不可能所有的人都在同时访问一篇文章,而是多人访问不同的文章,因而需要对文章编号进行参数化,以更好的模拟日常的性能测试场景.同时,因文 ...

  5. 关于移动app开发的一些不错的站点

    1. http://www.androiddevtools.cn      Android Dev Tools官网地址:www.androiddevtools.cn 收集整理Android开发所需的A ...

  6. matlab直方图均衡,使用向量优化

    matlab自带有histeq函数对图像进行直方图均衡 自己写了一个,改成向量化形式,效率提高了一点,但是比自带的还是差很多,差不多9倍 function D = my_histeq(I) [m,n] ...

  7. placeholder文字颜色与是否显示兼容性

    1.ie显示问题 <script type="text/javascript"> $(document).ready(function(){ var doc=docum ...

  8. git常用指令

    <a>github的提交方式      git status     (1)git add .--------------------存储到本地       git add -u      ...

  9. vim - save current file with a new name but keep editing current file

    http://superuser.com/questions/414110/vim-save-a-file-as-a-different-filename-but-keep-w-as-the-curr ...

  10. 解决UIScrollView把uitableviewcell的点击事件屏蔽

    cell中 [self.contentView addSubview:self.scrollView]; self.scrollView.userInteractionEnabled = NO; [s ...