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 ...
随机推荐
- 每次打开office 2013都提示配置进度,必须得等他下完然后重启,重启完了在打开,还是提示配置进度,怎么解决
方法一: 我用下面的方法完美解决.在控制面板中1.删除旧版本2010 或者20032.删除激活程序3.重装2013激活程序done 方法二: 我把WPS卸载了就好了. 方法三: 我是按这个方法解决的, ...
- VR相关学习资源
ptgui全景图制作工具 http://blog.csdn.net/xoyojank mems陀螺误差补偿的算法研究 http://www.docin.com/p-619540171.html 极客工 ...
- Codevs 1282 约瑟夫问题
1282 约瑟夫问题 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 大师 Master 题解 题目描述 Description 有编号从1到N的N个小朋友在玩一种 ...
- 浅谈volatile关键字
volatile是一种轻量级的同步机制.它可以保证内存可见性以及防止指令重排序,但是不保证原子性 volatile和JMM机制是不可分割的,在谈volatile的时候有必要先了解以下JMM JMM(J ...
- 初入Three.js 第一章
一.什么是WebGL? 1.WebGL是在浏览器中实现三维效果的一套规范. 二.什么是threejs? 1.你将它理解成three + js就可以了.three表示3D的意思,js表示javascri ...
- sequence(2018.10.23)
建出差分序列,可以发现最早出现的回文串就是答案,自己想想就懂了. \(O(N)\)找出回文串就好了,字符串\(hash\)或者\(manacher\)都能在合法时间内得到答案. #include< ...
- cobian backup 11 使用
主机和备份机器创建备份用户(bf) 在备份机器上 设置备份用户, 备份目录右键安全,添加刚刚创建的备份bf用户,并授予所有权限 设置文件夹共享,并设置共享用户为刚刚创建的bf用户 并且在高级共享设置去 ...
- JS创建函数的方法
方法一:函数声明. function foo(){ } 方法二:函数表达式. var foo=function(){ } 另外还有一种自执行函数表达式.主要用于创建一个新的作用域,在此作用域内声明的变 ...
- ES5(基本包装类型)字符串的方法
看一下字符串有哪些常用的方法: 1.concat();将多个文本组合起来,返回新的字符串,就是拼接字符串. 查找位置 2.indexOf();返回要匹配的字符在字符串第一次出现的索引,参数就是匹配的字 ...
- 用python编写一个计算器
# 1 - 2 * ((60-30 +(-40.0/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2)))# 通过Pyt ...