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
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.
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].
Jim_Green Alan_Blue
Green_small_Blue
解题思路:题目已经告诉你怎么输出答案了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的更多相关文章
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...
- 暴力 BestCoder Round #41 1001 ZCC loves straight flush
题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...
- 暴力 BestCoder Round #46 1001 YJC tricks time
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...
- 字符串处理 BestCoder Round #43 1001 pog loves szh I
题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...
- BestCoder Round #75 1001 - King's Cake
Problem Description It is the king's birthday before the military parade . The ministers prepared a ...
- BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...
- BestCoder Round #61 1001 Numbers
Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A1,A2....An,yo ...
- BestCoder Round #87 1001
GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...
- BestCoder Round #60 1001
Problem Description You are given a sequence of NNN integers. You should choose some numbers(at leas ...
随机推荐
- now code寒假练习赛2——处女座的砝码(找规律题+高精度题)
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { long double n ...
- 51nod 1067【简单博弈】
卧槽,第一次自己推推推做出来的... 对于1,那么就是A取完就好 --A 对于2,只能是A拿一个 --B 对于3和4,都是A拿完 --A 对于5,靠向2,A取3,B只能1 --A 对于6,A取一个的话 ...
- unity 引入 android第三方sdk
unity中调用java代码中介绍了unity调用android java代码的一些基础.引入android开发第三方sdk的操作跟调用java代码的操作相似,只是多了一步引入第三方jar. unit ...
- Unity2D研究院之自动生成动画、AnimationController、Prefab(一)
http://www.xuanyusong.com/archives/3243 国庆了,回家了.时刻还是要吃一颗学习的心,在家了也要抽出时间好好学习一下.之前MOMO一直没研究过Unity2D,今天研 ...
- CF438E The Child and Binary Tree(生成函数+多项式开根+多项式求逆)
传送门 可以……这很多项式开根模板……而且也完全不知道大佬们怎么把这题的式子推出来的…… 首先,这题需要多项式开根和多项式求逆.多项式求逆看这里->这里,这里讲一讲多项式开根 多项式开方:已知多 ...
- [Xcode 实际操作]八、网络与多线程-(12)使用异步Post方式查询IP地址信息
目录:[Swift]Xcode实际操作 本文将演示如何通过Post请求,异步获取IP地址信息. 异步请求与同步请求相比,不会阻塞程序的主线程,而会建立一个新的线程. 在项目导航区,打开视图控制器的代码 ...
- mysql项目实战经验
一.项目的编码设置 目的:避免出现莫名其妙错误,笔者曾经就碰到因编码不对返回null而浪费大量时间:统一的编码可以减少解析的时间,提高效率 1.1修改my.ini文件 一般在C:\Program ...
- bzoj4300 绝世好题 【dp】By cellur925
题目描述: 给定一个长度为\(n\)的数列\(a\),求\(a\)的子序列\(b\)的最长长度,满足bi&bi-1!=0(\(2<=i<=len\)). 90分做法: 并没有部分分 ...
- BZOJ2440(容斥+莫比乌斯函数)
题目本质: 首先有如下结论: 而通过写一写可以发现: 举例来讲,36及其倍数的数,会被1的倍数加一遍,被4的倍数扣一遍,会被9的倍数扣一遍,而为了最终计数为0,需要再加回来一遍,所以在容斥里面是正号. ...
- 8593 最大覆盖问题 two pointer
8593 最大覆盖问题 时间限制:50MS 内存限制:1000K提交次数:193 通过次数:88 题型: 编程题 语言: G++;GCC;VC Description 输入格式 第1行是正整数n ...