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. LeetCode: 500 Keyboard Row (easy)

    题目: Given a List of words, return the words that can be typed using letters of alphabet on only one ...

  2. 51nod1459【二级最短路】

    标签说的是BFS... 太菜,不知道怎么BFS...是不是spfa写,就叫BFS...感觉不是.... 只是二级最短路的写法,直接搞就很容易了,简单题: #include <bits/stdc+ ...

  3. hdoj 1588 学好线代与数学

    按部就班,超级简单,虽然不是一次过的...错在那个long long数据问题还是要注意..也不知道要怎么注意:还是说题目吧... 思路看main函数 其他函数功能也是非常有用!代码比较丑...见谅 # ...

  4. 地理位置(navigation.geolocation)与本地存储(seessionStorage、localStorage)

    一.地理位置( geolocation ): navigator.geolocation对象: 1.单次请求: //navigator.geolocation.getCurrentPosition( ...

  5. 详解什么是redis

    企业中redis是必备的性能优化中间件,也是常见面试题,首先Redis是由意大利人Salvatore Sanfilippo(网名:antirez)开发的一款内存高速缓存数据库.Redis全称为:Rem ...

  6. ubuntu 安装 RPostgreSQL 库

    其实大家在Linux 的R 中安装其他库,完全可以使用R 自带的安装方式,只是这个 RPostgreSQL 库需要用到 postgresql 的lib 库与include 头文件,所以才有若干个步骤去 ...

  7. perl C/C++ 扩展(二)

    第二讲perl 加载c/c++的库 先通过h2xs 创建一个新的工程 h2xs -A -n two_test 进入目录 cd two_test 创建一个mylib文件夹,存放静态库 mkdir myl ...

  8. echarts相关属性设置(2)--折线图和柱状图的结合使用

    type:bar和line的组合 option = { { tooltip: { trigger: 'axis', axisPointer: { // type: 'shadow' }, // lab ...

  9. [題解](最短路/二分)luogu_P1462通往奧格瑞瑪的道路

    看到最大的最小值應該想到二分答案,這樣就解決了最小點權的問題,判血量就很好說,直接比較就行, 一個點是二分點權數組,複製一份然後排序,二分下標,速度較快 這麼簡單的題我竟然寫了這麼長時間 #inclu ...

  10. django-返回客户端外网ip服务

    在服务器应用初始化的时候,比如salt-minion,需要在配置文件里说明自己的id,一般用ip. 如果都在一个内网里,从ip命令里获取就行了. 但现在的企业后台环境更加复杂,很多都是跨机房.有物理机 ...