刚哥遇到了感情问题(二)
时间限制:1000 ms  |  内存限制:65535 KB
难度:1
描述
上一集我们讲到 作为工作室老大的刚哥遇到很多女生的追求,你帮他个挑选了个英语成绩不错的对象。在你的帮助下,刚哥找到了个    英语学霸村    的小花,刚哥对小花的追求并不是那么一帆风顺。事情是这样的:为了追求小花,刚哥打算给小花写点情书,然而小花却要求刚哥用英文给她写情书,并且要求刚哥不许使用百度翻译,这可难为刚哥了,刚哥自幼就爱国,对西洋文不怎么感冒,幸得健爷的帮助,刚哥成功把中文的情书翻译成了英文的情书,然而问题来了,刚哥写的情书太肉麻,健爷决定把   miss  love  kiss  这三个单词替换成  apple  banana  orange  ,眼看着今晚就要约会了,没有这些肉麻的词,刚哥约会时会不自在的.你能在今晚10点前帮刚哥把信里面出现这三个单词的地方合理地用  miss  love  kiss  替换吗?刚哥都快急哭了,你就帮帮他吧  O(∩_∩)O~输入
多组输入一次输入多行情书以 thas all 结束
程序 读到文档结束。
输出
帮刚哥把信里面出现这三个单词的地方合理地用 miss love kiss 替换, 原格式输出。
样例输入
Dear Mine: Just for one reason, I banana you so much. Nothing is impossible to a willing mind,
banana included. Therefore, day after day, I wonder why,
I wonder how, I wonder where you are. Time to go, I want to tell you how much I feel,
and how much I banana you. When I think of you, the miles between us disappear. Seeing you will cause me an indescribable thrill,
even at the sight of your handwriting will make me tremble. And the wonderful times we shared together shall always remain in my heart. You are my little angel. Just having you close fills me with banana and hope;
nothing is impossible by your side. It is only when I nearly lose you that I become fully conscious of how much I value you.
Accordingly, I would say, "I banana you" for millions and billions of times,
and times and times again. Everything comes and goes, but banana stays. When you need someone,
remember that I'd be there.
If I were in heaven,
I'd write your name on every star for all to see just how much you mean to me. No matter how long the road may be in the future,
please cherish every moment we shared together. No matter how many years will pass away,
please treasure our banana till the last day. banana is the triumph of imagination over intelligence.thas alli apple you
i banana you
i orange you
thas all样例输出
Dear Mine: Just for one reason, I love you so much. Nothing is impossible to a willing mind,
love included. Therefore, day after day, I wonder why,
I wonder how, I wonder where you are. Time to go, I want to tell you how much I feel,
and how much I love you. When I think of you, the miles between us disappear. Seeing you will cause me an indescribable thrill,
even at the sight of your handwriting will make me tremble. And the wonderful times we shared together shall always remain in my heart. You are my little angel. Just having you close fills me with love and hope;
nothing is impossible by your side. It is only when I nearly lose you that I become fully conscious of how much I value you.
Accordingly, I would say, "I love you" for millions and billions of times,
and times and times again. Everything comes and goes, but love stays. When you need someone,
remember that I'd be there.
If I were in heaven,
I'd write your name on every star for all to see just how much you mean to me. No matter how long the road may be in the future,
please cherish every moment we shared together. No matter how many years will pass away,
please treasure our love till the last day. love is the triumph of imagination over intelligence.thas alli miss you
i love you
i kiss you
thas all
个人理解:
本次作业不会写,是看了学长的代码之后自己敲一遍的!!!!!!!


#include<stdio.h>
#define N 201
char A[][7]={"apple","banana","orange"};
char B[][5]={"miss","love","kiss"};
int S[]={4,5,5},num,D[2][N];
char C[N];
int BF(char a[],char b[],int c[]);
void change(int *a,int *b);//交换
void sort(int A[][N],int left,int right);//升序
int main()
{int i,j,k;while(gets(C)){for(i=j=num=0;i<3;i++){k=BF(C,A[i],D[0]);while(k--)D[1][j++]=i;}sort(D,0,num-1);for(i=j=0;C[i];i++){if(i==D[0][j]&&j<num){printf("%s",B[D[1][j]]);i+=S[D[1][j++]];}elseprintf("%c",C[i]);}printf("\n");}return 0;
}
int BF(char a[],char b[],int c[])
{int i=0,j=0,k=num;do{if(b[j]&&a[i++]==b[j])++j;else{b[j]?(i-=j):(c[num++]=i-j);j=0;}}while(a[i-1]);return num-k;
}
void change(int *a,int *b)
{int c=*a;*a=*b;*b=c;
}
void sort(int A[][N],int left,int right)
{int i=left,j=right,t=A[0][left];if(left>=right)return;while(i!=j){while(A[0][j]>=t&&i<j)j--;while(A[0][i]<=t&&i<j)i++;if(i<j){change(&A[0][i],&A[0][j]);change(&A[1][i],&A[1][j]);}}change(&A[0][left],&A[0][i]);change(&A[1][left],&A[1][i]);sort(A,left,i-1);sort(A,i+1,right);
}
												

刚哥遇到了感情问题(2)相关推荐

  1. 音频文件 数据库存储_刚哥谈架构 (六) 谈谈数据库架构

    无论是构建什么样的应用,大都离不开数据.而在应用的架构设计中,如何设计数据库,使用什么类型的数据库,就是一个架构师必须了解的.所有的数据库的共同点都是以某种方式存储数据,以某种接口来访问存储的数据.我 ...

  2. 刚哥谈架构 (五)- 推荐给架构师的书单

    刚哥谈架构 (五)- 推荐给架构师的书单 今天收到豆瓣的2019年的总结,发现自己已经在豆瓣渡过10个春秋.今年读了69本书,有很多书非常棒.今天我就给各位架构师,程序员,码农推荐一些我觉得对工作和职 ...

  3. 跟着刚哥梳理java知识点——多线程(十六)

    创建多线程 第一种方式: ① 继承:继承Thread. ② 重写:重写Thread类的run()方法 ③ 创建:创建一个子类的对象 ④ 调用:调用线程的start()方法,启动此线程,调用run()方 ...

  4. 刚子扯谈:微信 今天你打飞机了嘛吗?

    文/刚子 2013年8月5日 开片语:昨日爆爬二坨山后,精神豁然靓丽.虽然晒伤的不算厉害,但是还是有同事关切.说刚子你真黑了.好吧!当然今天咱不扯爬山涉水,也不扯刚子咋就黑了,咱扯今天那个" ...

  5. 反驳李刚的针对我吐槽的回应,曝光疯狂java李刚的骗子行径

    上个月刚进了一家公司,要适应很多新的东西,上社区的时间少,这两天才关注到李刚对我吐槽内容的回复(发现他在微博上早就回复了),在回应中不断继续吹嘘自己如何如何,看得我都起鸡皮疙瘩了. 关于我吐槽的疯狂J ...

  6. 刚子扯谈:源于Chanel的图片描述

    文/刚子 2013年8月9日 北京晴 猴晒猴晒 开片语:真心不知道今天该分享点啥?先扯几句牢骚,我个人认为对朋友也够意思,虽然他们有的时候挺操蛋的,虽然还简称哥们儿,虽然还一起交流,但已经变成了无谓的 ...

  7. 扒一扒呱哥Q1都干了什么

    弹指之间,我又老了一岁,不是占大家便宜,喊我呱哥你绝对不吃亏.当然我们群的刚哥,贾哥,鹏哥除外. 这一个季度总体来看还比较有意思,新鲜感给人带来的刺激,一点都不乏味. 1.工作上 熟悉我的朋友都知道, ...

  8. 2015结束,2016开始

    用两个字形容2015,艰难. 一月1号,朋友创业开店庆祝开业. 第二天离开一起生活了5年的圈子. 加班,加班无止境的加班..... 二月,过年,整个人都是蒙的,不清醒.喝了很多酒,没醉.这个年过得很平 ...

  9. 噩梦的那一年-程序员之路

    一.放弃考研 "请问是钱某四同学吗?" "我就是." "你好,我是人民大学招生办,我想问你昨天怎么没来照相啊?" "啊...我已经 ...

  10. 奋斗吧,程序员——第二十二章 事了拂衣去,深藏身与名

    穿过黝黑的通道,时不时看到有人从走廊两边的房间风风火火地跑出来,差点和我撞个满怀. 外包公司确实是程序员里最苦逼的一群,这些人上厕所都是用跑的. "索尼租下这幢大楼,专门供给第三方公司员工使 ...

最新文章

  1. java 中断 继续_中断,继续并在Java循环中标记
  2. Lesson 9.5 从0实现多层神经网络的正向传播
  3. jquery插件最佳实践之progressbar
  4. WPF XAML 为项目设置全局样式
  5. SpringBoot中Bean按条件装配
  6. 调整心态,正确应对所学技术的失宠?(至F#,SL的学习者们)
  7. NanoDet-Plus的学习笔记
  8. EverWeb for Mac(网页设计软件)v3.5.1中文版
  9. RF射频传输,原理介绍,三分钟看懂!发射功率、接收灵敏度详解!
  10. python和c 情侣网名_超可爱超有趣的情侣ID
  11. Your binary is not optimized for iPhone 5” (ITMS-90096) when submitting
  12. 电脑上的PDF文件太大了怎么办?
  13. 微软Visio流程图软件,Visio流程图制作工具下载安装教程(1)
  14. 写自己的故事,帮别人说话
  15. Intraweb之EasyUI篇
  16. 心电图心跳信号多分类预测(一)
  17. 交通灯定时控制系统的设计
  18. 光谱特征选择---竞争自适应重加权采样CARS
  19. 关于Python3.5及以上版本 install failed安装失败问题
  20. Kanzi Studio介绍与安装注意

热门文章

  1. KeyError: ((1, 1, 512), ‘|u1‘) 报错
  2. 关于邮箱发送信息的代码工具
  3. 编程语言基础心得体会
  4. jupyternotebook 报告_利用Jupyter Notebook制作美观的数据报告
  5. 第十一周(11.24-12.01)----final评论II
  6. 英特尔收购威盛X86业务 兆芯何去何从
  7. R语言打开文件乱码问题解决方法
  8. 江门职业技术学院计算机录取分数线,江门职业技术学院2020招生录取分数线
  9. 4个WinRAR使用技巧
  10. Python+MySQL爬取船讯网AIS静态数据