hdu 5082 Love(Bestcoder Round #15)
来源:互联网 发布:特殊字体生成器软件 编辑:程序博客网 时间:2024/06/01 17:49
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.
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].
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
[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_GreenAlan_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;}
0 0
- hdu 5082 Love(Bestcoder Round #15)
- Bestcoder Round 15# 1001 Love
- BestCoder Round #92-1003 Girls Love 233
- HDU 5083 Instruction &&Bestcoder round#15 1002
- hdu 5083 Instruction(Bestcoder Round #15)
- HDU BestCoder Round #48 1001
- hdu 5641 BestCoder Round #75
- hdu 5643 BestCoder Round #75
- BestCoder Round #83(HDU 5680)
- BestCoder Round #15 1001
- BestCoder Round #15 1002
- BestCoder Round #48 ($) (hdu 5284、hdu 5285)
- [BestCoder Round #3] hdu 4908 BestCoder Sequence (计数)
- hdu 4908 BestCoder Sequence && BestCoder Round #3 1002
- HDU 4908 BestCoder Sequence——BestCoder Round #3
- HDU BestCoder Round #1 1002 项目管理
- BestCoder round#3 1001 && Hdu 4907
- HDU 4907 Task schedule(BestCoder Round #3 )
- 《炉石传说》架构设计赏析(6):卡牌&技能数据的运行时组织
- glMatrixMode
- 计算并集
- LeetCode: Maximum Product Subarray
- 内部类——局部内部类
- hdu 5082 Love(Bestcoder Round #15)
- hdu 5083 Instruction(Bestcoder Round #15)
- 【Leetcode】Rotate Image (Rotated)
- ODBC链接SQL Express 2014
- 稳压管 是正的温度系数 三极管得BE结是负的温度系数
- 2014.10.26项目3
- 堆排序算法及实现
- 好的卡极度疯狂勒紧裤带十分感激收到回复的健康试试
- 小米账户的同步问题