题目大意:给一个由单词组成的句子,只反转单词内部的次序而不改变单词之间的次序。如“I love you.”转换成“I evol .uoy”。

 #include <cstdio>
#include <cstring> int main()
{
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
int s, e;
char str[];
while (gets(str))
{
bool in_word = false;
int len = strlen(str);
int p = ;
while (p < len)
{
while (p < len && str[p] == ' ')
{
putchar(' ');
p++;
}
s = p;
while (p < len && str[p] != ' ') p++;
e = p - ;
for (int i = e; i >= s; i--)
putchar(str[i]);
}
printf("\n");
}
return ;
}

UVa 483 - Word Scramble的更多相关文章

  1. UVa 642 - Word Amalgamation

    题目:给你一个单词列表.再给你一些新的单词.输出列表中又一次排列能得到此新单词的词. 分析:字符串.对每一个字符串的字母排序生成新的传f(str).总体排序,用二分来查找就可以. 说明:注意输出要满足 ...

  2. Uva 642 - Word Amalgamation sort qsort

     Word Amalgamation  In millions of newspapers across the United States there is a word game called J ...

  3. qsort和sort学习与比较

    阅读另一篇博文Uva 642 - Word Amalgamation sort qsort 1.qsort函数: 原 型: void qsort(void *base, int nelem, int ...

  4. UVA 1401 - Remember the Word(Trie+DP)

    UVA 1401 - Remember the Word [题目链接] 题意:给定一些单词.和一个长串.问这个长串拆分成已有单词,能拆分成几种方式 思路:Trie,先把单词建成Trie.然后进行dp. ...

  5. UVA 1401 Remember the Word

    字典树优化DP                                Remember the Word Time Limit: 3000MS   Memory Limit: Unknown ...

  6. UVA 1401 Remember the Word(用Trie加速动态规划)

    Remember the Word Neal is very curious about combinatorial problems, and now here comes a problem ab ...

  7. UVA - 1401 | LA 3942 - Remember the Word(dp+trie)

    https://vjudge.net/problem/UVA-1401 题意 给出S个不同的单词作为字典,还有一个长度最长为3e5的字符串.求有多少种方案可以把这个字符串分解为字典中的单词. 分析 首 ...

  8. UVa Live 3942 Remember the Word - Hash - 动态规划

    题目传送门 高速路出口I 高速路出口II 题目大意 给定若干种短串,和文本串$S$,问有多少种方式可以将短串拼成长串. 显然,你需要一个动态规划. 用$f[i]$表示拼出串$S$前$i$个字符的方案数 ...

  9. UVa 1401 (Tire树) Remember the Word

    d(i)表示从i开始的后缀即S[i, L-1]的分解方法数,字符串为S[0, L-1] 则有d(i) = sum{ d(i+len(x)) | 单词x是S[i, L-1]的前缀 } 递推边界为d(L) ...

随机推荐

  1. Mybatis学习(5)高级映射

    需求: 一.一对一查询 查询订单信息,关联查询创建订单的用户信息: orders--->user:一个订单只由一个用户创建,一对一 orders表 和 user表: 1)使用resultType ...

  2. Ubuntu root 密码设置及远程登录

    1. 修改 root 密码 sudo passwd root 2. 以其他账户登录,通过 sudo nano 修改 /etc/ssh/sshd_config : xxx@ubuntu14:~$ su ...

  3. POJ 1821 单调队列+dp

    题目大意:有K个工人,有n个墙,现在要给墙涂色.然后每个工人坐在Si上,他能刷的最大范围是Li,且必须是一个连续子区间,而且必须过Si,他刷完后能获得Pi钱 思路:定义dp[i][j]表示前i个人,涂 ...

  4. 安装psutil模块报错&安装python-devel

    psutil/_psutil_linux.c:9:20: 错误:Python.h:没有那个文件或目录 In file included from psutil/_psutil_linux.c:19:p ...

  5. android脚步---APP引导页添加

    package com.leadcore.uudatoutie; import java.util.ArrayList; import com.leadcore.uudatoutie.R; impor ...

  6. HDU 1203 I NEED A OFFER! 01背包 概率运算预处理。

    题目大意:中问题就不说了 ^—^~ 题目思路:从题目来看是很明显的01背包问题,被录取的概率记为v[],申请费用记为w[].但是我们可以预先做个处理,使问题解决起来更方便:v[]数组保留不被录取的概率 ...

  7. 基于Verilog HDL 各种实验

    菜鸟做的的小实验链接汇总:           1.基于Verilog HDL 的数字时钟设计 2.乘法器 3.触发器(基本的SR触发器.同步触发器.D触发器) 4.基于Verilog HDL的ADC ...

  8. Android---Parcelable包装类的作用

    android提供了一种新的类型:Parcel.本类被用作封装数据的容器,封装后的数据可以通过Intent或IPC传递. 除了基本类型以外,只有实现了Parcelable接口的类才能被放入Parcel ...

  9. Git 常用命令速查表(三)

    http://blog.csdn.net/sunboy_2050/article/details/7529841

  10. Android学习笔记之Service

    与服务通信 用bindservice 而startservice并无通信条件. service 为android为系统服务,所以程序员无法new出来,只能建立服务,共其他组件使用. package c ...