http://acm.hdu.edu.cn/showproblem.php?pid=5082

Love

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

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
 

Source
 

解题思路:题目已经告诉你怎么输出答案了0.0 -》 the format [first name of male]_small_[first name of female].

 1 #include <stdio.h>
 2 #include <string.h>
 3 
 4 int main(){
 5     char str1[], str2[], str3[], str4[];
 6     int len, i, j;
 7     while(scanf("%s %s", str1, str2) != EOF){
 8         len = strlen(str1);
 9         for(i = ; i < len; i++){
             if(str1[i] == '_'){
                 break;
             }
         }
         i++;
         for(j = i; j < len; j++){
             str3[j - i] = str1[j];
         }
         str3[j - i] = '\0';
 
         len = strlen(str2);
         for(i = ; i < len; i++){
             if(str2[i] == '_'){
                 break;
             }
         }
         i++;
         for(j = i; j < len; j++){
             str4[j - i] = str2[j];
         }
         str4[j - i] = '\0';
         printf("%s_small_%s\n", str3, str4);
     }
     return ;

34 }

BestCoder Round#15 1001-Love的更多相关文章

  1. 贪心 BestCoder Round #39 1001 Delete

    题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...

  2. 暴力 BestCoder Round #41 1001 ZCC loves straight flush

    题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...

  3. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  4. 字符串处理 BestCoder Round #43 1001 pog loves szh I

    题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...

  5. BestCoder Round #75 1001 - King's Cake

    Problem Description It is the king's birthday before the military parade . The ministers prepared a ...

  6. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  7. BestCoder Round #61 1001 Numbers

    Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A​1​​,A​2​​....A​n​​,yo ...

  8. BestCoder Round #87 1001

    GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...

  9. BestCoder Round #60 1001

    Problem Description You are given a sequence of NNN integers. You should choose some numbers(at leas ...

随机推荐

  1. lightoj1087 【线段树】

    题意: 给你n个数,然后给你q个询问,有两种询问: a: 表示在右边插入一个数 c:表示从左边拿出一个数,然后输出: 思路: 一开始在想,自己手上的黑科技:线段树和树状数组 线段树上的操作: 求区间最 ...

  2. HDU4973 【几何。】

    题意: 给你一个以原点为圆心的两个圆,一个大圆,一个小圆,然后给你一个硬币和他的速度,问你经过大圆的时间: 思路: 直接杠.. 然后wa的怀疑人生,后面wa在了速度的方向,如果我说一个点在两个圆的左上 ...

  3. IT兄弟连 JavaWeb教程 使用JSTL函数

    在JSTL Functions标签库中提供了一组常用的EL函数,主要用于处理字符串,在JSP中可以直接使用这些函数. 在JSP中使用Functions标签库,需要通过taglib指令引入该标签库: & ...

  4. redis连接错误

    连接redis错误:ERR Client sent AUTH, but no password is set 2018-07-04 20:33 by robinli, 4367 阅读, 0 评论, 收 ...

  5. [題解](單調隊列dp)【2016noip福建夏令營】探險

    P1917 -- 探险 时间限制:1000MS      内存限制:131072KB 题目描述(explore.cpp) π+e去遗迹探险,遗迹里有 N 个宝箱,有的装满了珠宝,有的装着废品. π+e ...

  6. C#基础之析构函数

  7. Flask (二) cookie 与 session 模型

    会话技术 Cookie 客户端端的会话技术 cookie本身由浏览器保存,通过Response将cookie写到浏览器上,下一次访问,浏览器会根据不同的规则携带cookie过来 ​ 特点:   - 客 ...

  8. [poj 2104] K-th Number【主席树】

    传送门:http://poj.org/problem?id=2104 保存模版. #include <cstdio> #include <algorithm> #include ...

  9. HDU 3117 Fibonacci Numbers 数学

    http://acm.hdu.edu.cn/showproblem.php?pid=3117 fib是有一个数学公式的. 这里的是标准的fib公式 那么fib = 1 / sqrt(5) * ((1 ...

  10. memcache学习

    1.memcache和memcached区别 Memcache是该系统的项目名称,Memcached是该系统的主程序文件(字母d可以理解为daemon),以守护程序方式运行于一个或多个服务器中,随时接 ...