hdu 5082 Love(Bestcoder Round #15)

Love

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 78    Accepted Submission(s): 57

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 <cstdio>
#include <string>
#include <cstring>
using namespace std;
string s1,s2;
int main()
{
    while(cin>>s1>>s2)
    {
        string s;
        s.clear();
        int i;
        for(i=0;i<s1.size();i++)
        {
            if(s1[i]=='_')
            break;
        }
        for(i=i+1;i<s1.size();i++)
        {
            s.push_back(s1[i]);
        }
        string temp="_small_";
        s=s+temp;
        for(i=0;i<s2.size();i++)
        {
            if(s2[i]=='_')
            break;
        }
        for(i=i+1;i<s2.size();i++)
        {
            s.push_back(s2[i]);
        }
        cout<<s<<endl;
    }
    return 0;
}
时间: 2024-10-21 01:20:16

hdu 5082 Love(Bestcoder Round #15)的相关文章

HDU 5671 Matrix (BestCoder Round #81 (div.2) 1002)

传送门 Matrix Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 311    Accepted Submission(s): 142 Problem Description There is a matrix M that has n rows and m columns (1≤n≤1000,1≤m≤1000).Then we

HDU 5124 lines(BestCoder Round #20)

Problem Description: John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants to know how many lines cover A. Input: The first line contains a single integer T(1≤T≤100)(the data for 

HDU 5167 Fibonacci(BestCoder Round #28)

Problem Description: Following is the recursive definition of Fibonacci sequence: Fi=???01Fi−1+Fi−2i = 0i = 1i > 1 Now we need to check whether a number can be expressed as the product of numbers in the Fibonacci sequence. Input: There is a number T 

HDU 5101 Select(BestCoder Round #17)

Problem Description: One day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting game. He wants to take part in the game. But as we all know, you can't get good result without teammates.So, he needs to select two classmates as

hdu 4956 Poor Hanamichi BestCoder Round #5(数学题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4956 Poor Hanamichi Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7    Accepted Submission(s): 4 Problem Description Hanamichi is taking part in

HDU 4932 Miaomiao&#39;s Geometry(BestCoder Round #4)

Problem Description: There are N point on X-axis . Miaomiao would like to cover them ALL by using segments with same length. There are 2 limits: 1.A point is convered if there is a segments T , the point is the left end or the right end of T.2.The le

BestCoder Round#15 1001-Love

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

hdu4932 Miaomiao&#39;s Geometry (BestCoder Round #4 枚举)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4932 Miaomiao's Geometry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 410    Accepted Submission(s): 147 Problem Description There are N point

hdu4932 Miaomiao&amp;#39;s Geometry (BestCoder Round #4 枚举)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4932 Miaomiao's Geometry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 410    Accepted Submission(s): 147 Problem Description There are N point