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. 关于 JS 模块化的最佳实践总结

    模块化开发是 JS 项目开发中的必备技能,它如同面向对象.设计模式一样,可以兼顾提升软件项目的可维护性和开发效率. 模块之间通常以全局对象维系通讯.在小游戏中,GameGlobal 是全局对象.在小程 ...

  2. 3687: 简单题(bitset)

    3687: 简单题 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 700  Solved: 319[Submit][Status][Discuss] ...

  3. P3819 松江1843路(洛谷月赛)

    P3819 松江1843路 题目描述 涞坊路是一条长L米的道路,道路上的坐标范围从0到L,路上有N座房子,第i座房子建在坐标为x[i]的地方,其中住了r[i]人. 松江1843路公交车要在这条路上建一 ...

  4. selenium界面元素定位

    一.        Selenium界面元素定位 本文元素定位以das2为例 #导入包 from selenium import  webdriver #打开火狐驱动 driver=webdriver ...

  5. Lua1

    使用lua进行脚本编程有很多优点: 1 代码体积小 2 执行速度快 3 安全性较高等 4 但是最大的优点是修改后的代码不需要重新编译即可生效,而高级语言的代码经过修改后需要经过重新编译或者解释后才能生 ...

  6. crmsh语法

    .查看配置信息 crm(live)# configure crm(live)configure# show node node1 node node2 property cib-bootstrap-o ...

  7. Tomcat 顶层结构

    Tomcat中最顶层的容器叫Server,代表整个服务器,Server中包含至少一个Service,用于具体提供服务. Service主要包含两部分:Connector   和   Container ...

  8. 01、dos命令行的常用命令

    cd 进入指定目录cd..  返回上一级目录cd\   退回盘符根目录dir        列出当前目录下的文件以及文件夹md       创建目录rd 删除目录del   删除文件cls       ...

  9. jQuery选择器之全选择器(*选择器)

    在css中,经常会在第一行写下这样一段样式: * { margin:; padding:; } 通配符*意味着给所有的元素设置默认的边距.jQuery中我们也可以通过传递*选择器来选中文档页面中的元素 ...

  10. Zigzag数组 -- 面试宝典

    最近在看面试宝典,其中看到一个题目说:输入一个正整数n,输出它的zigzag数组. 分析:书上给出了数学方面的思考然后给了代码.但是我感觉如果真是面试或者考试遇到的话,我这种笨脑袋肯定是想不出来的,因 ...