Love

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 875    Accepted Submission(s): 536

Problem Description
There
is a Love country with many couples of Darby and Joan in it. In order
to commemorate their love, they will do some thing special when giving
name to their offspring.
When a couple want to give name to their
offspring, they will firstly get their first names, and list the one of
the male before the one of the female. Then insert the string “small”
between their first names. Thus a new name is generated. For example,
the first name of male is Green, while the first name of the female is
Blue, then the name of their offspring is Green small Blue.
You are expected to write a program when given the name of a couple, output the name of their offsping.
 
Input
Multi test cases (about 10), every case contains two lines.
The first line lists the name of the male.
The second line lists the name of the female.
In each line the format of the name is [given name]_[first name].
Please process to the end of file.

[Technical Specification]
3 ≤ the length of the name ≤ 20
[given name] only contains alphabet characters and should not be empty, as well as [first name].

 
Output
For each case, output their offspring’s name in a single line in the format [first name of male]_small_[first name of female].
 
Sample Input
Jim_Green
Alan_Blue
 
Sample Output
Green_small_Blue
 
取出'_'后面的串然后拼到一起。
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
using namespace std; int main()
{
char s1[],s2[];
while(scanf("%s %s",s1,s2)!=EOF){
int len1 = strlen(s1);
int len2 = strlen(s2);
int cnt = ,cnt1 = ;
bool flag = false;
for(int i=;i<len1;i++){
if(s1[i]=='_') flag = true,i++;
if(flag){
s1[cnt++] = s1[i];
}
}
flag = false;
for(int i=;i<len2;i++){
if(s2[i]=='_') flag = true,i++;
if(flag){
s2[cnt1++] = s2[i];
}
}
for(int i=;i<cnt;i++) printf("%c",s1[i]);
printf("_small_");
for(int i=;i<cnt1;i++) printf("%c",s2[i]);
printf("\n");
}
return ;
}

hdu 5082(水题)的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  3. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  4. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

  5. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  6. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

  7. hdu 5162(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...

  8. hdu 3357 水题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...

  9. hdu 5038 水题 可是题意坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数  这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心  If not all ...

随机推荐

  1. HTML标准开头

    <!doctype html> <html>   <head> <meta charset="utf-8"> <title&g ...

  2. laravel5.5配置信息

    目录 1 环境配置 1.1 检索环境配置 1.2 确定当前环境 2 访问配置值 3 配置缓存 4 维护模式 配置文件在config目录下,为了便于不同人员的开发,我们可以使用不同的.env文件来配置各 ...

  3. ubuntu上通用解压方式

    ubuntu上通用解压方式 tar xvf *.bin.tar.gz,gz,tar.tgz

  4. FTP使用心得

    1、创建文件夹的函数,一次只能创建一层。 2、没有现成的判断文件夹是否存在的函数,如果文件夹不存在就创建,会报异常。有以下封装好的函数。可以直接调用。 1 2 3 4 5 6 7 8 9 10 11 ...

  5. SSH非交互式密码授权远程执行脚本

    公司有上百台服务器,需要为每台服务器都执行一个脚本,因为所有服务器的账号密码都是一样的,所以可以不用搭建ansible等自动化运维工具,我们直接通过SSH远程执行即可完成. 本文以三台服务器为例,系统 ...

  6. Oz 创建Debian8镜像

    <template> <name>Debian8.7-zxy</name> <os> <name>Debian</name> & ...

  7. HDU 4661 Message Passing ( 树DP + 推公式 )

    参考了: http://www.cnblogs.com/zhsl/archive/2013/08/10/3250755.html http://blog.csdn.net/chaobaimingtia ...

  8. PB常用事件

    1.window中的事件 事件名                  触发的时机 01.Activate            在窗口激活之前触发 02.Clicked             当用户用 ...

  9. Python函数参数中的冒号与箭头

    在一些Python的工程项目中,我们会看到函数参数中会有冒号,有的函数后面会跟着一个箭头,你可能会疑惑,这些都是什么东西? 其实函数参数中的冒号是参数的类型建议符,告诉程序员希望传入的实参的类型.函数 ...

  10. BZOJ 1483:[HNOI2009]梦幻布丁(链表+启发式合并)

    [HNOI2009]梦幻布丁 Description N个布丁摆成一行,进行M次操作.每次将某个颜色的布丁全部变成另一种颜色的,然后再询问当前一共有多少段颜色.例如颜色分别为1,2,2,1的四个布丁一 ...