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 ...
随机推荐
- hdu2147(yy)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2147 题意:给出一个n*m的矩阵,一开始有个点在最右上方, 两个人轮流移动点,可以向左移一格,或者向下 ...
- 小试JVM工具
一.前言 工欲善其事必先利其器,jdk自带了很多工具,利用好这些工具能够帮我们获取想要的数据(运行日志.异常堆栈.GC日志.线程快照.堆转储快照等),从而快速的分析数据.定位问题. 二.jps:虚拟机 ...
- (转) Git
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
- AngularJS - 入门小Demo
AngularJS四大特效 MVC模式.模块化设计.自动化双向数据绑定.依赖注入 如果了解了后端开发知识,想必对这些词汇不会陌生,AngularJS融合了后端开发的一些思想,虽然身为前端框架,但与jQ ...
- [coci2015-2016 coii] dijamant【图论】
传送门:http://www.hsin.hr/coci/archive/2015_2016/ 进去之后的最下面的国家赛.顺便说一句,dijamant是克罗地亚语的“钻石”的意思. 官方题解是说压位的暴 ...
- html原样输出html代码
<xmp>********</xmp> 在网页上显示html代码标记<xmp></xmp>有时我们会将html代码显示在网页上,直接写会有问题, 如果我 ...
- matlab实现gabor滤波器的几种方式
转自:http://blog.csdn.net/watkinsong/article/details/7882443 方式一: function result = gaborKernel2d( lam ...
- Oracle如何创建表空间
create user frame identified by tiger; grant create session to frame; grant create table to frame; g ...
- javaScript面向对像
1.创建对象 <script type="text/javascript"> function Flower(name,addre) { this.name=name; ...
- Ubuntu系统下安装字体和切换默认字体的方法
参考链接:http://my.oschina.net/itblog/blog/278566 打开Ubuntu的软件中心,搜索:tweak,安装[Unity Tweak Tool]这款软件,如图(由于我 ...