字符串
文章平均质量分 57
Xq_23
23考研,所以没时间更新代码了~
展开
-
KMP算法解析
KMP是比较难理解的举个例子 比如12121121212121当12121和121212121匹配时当前五个匹配完毕时,会发现12121的后缀121就是他的前缀,所以这时候只需要去匹配12121后面的21,因为12121的前缀121和刚才匹配完毕的12121的后缀是相同的,所以这时候就简化为匹配12121后面的21....原创 2021-07-18 18:50:56 · 69 阅读 · 0 评论 -
学生成绩查找系统
学生成绩查找系统是一个根据姓名查找学生成绩的系统。系统可以录入是学生的姓名和成绩,录完之后可以输入查找条件,即学生的姓名,查找该生的成绩,如果存在该生的信息,则输出该生成绩,否则给出查无此人的提示信息。输入:题目输入包括录入学生信息和输入查找条件以及输入结束标志。insert语句表示录入学生信息,格式为字符insert+空格+字符串+空格+数字+换行符 ,例如 insert xiaohua 99 ,表示录入姓名为xiaohua的学生,其成绩为99 。 find语句表示查找某学生的信息,格式为字符find+原创 2021-01-30 15:46:38 · 893 阅读 · 0 评论 -
输出最高分数的学生姓名
输入学生的人数,然后再输入每位学生的分数和姓名,求获得最高分数的学生的姓名。输入格式第一行输入一个正整数N(N≤100),表示学生人数。接着输入N行,每行格式如下:分数 姓名分数是一个非负整数,且小于等于100;姓名为一个连续的字符串,中间没有空格,长度不超过20。数据保证最高分只有一位同学。输出格式获得最高分数同学的姓名。Sample Input587 lilei99 hanmeimei97 lily96 lucy77 jimSample Outp原创 2021-01-30 15:45:52 · 1451 阅读 · 1 评论 -
Rank List(map应用)+map的理解
先看题,最后面讲mapLi Ming is a good student. He always asks the teacher about his rank in his class after every exam, which makes the teacher very tired. So the teacher gives him the scores of all the student in his class and asked him to get his rank by himself原创 2021-01-24 11:45:18 · 372 阅读 · 0 评论 -
学生信息用qsort排序
将输入的学生信息按名字排序后输出。Input每个学生信息是两行,第一行是名字,由英文字母和空格构成,最长18个字符;第二行格式为:学号,性别 年龄学号是一个不超过100,000的整数; 性别是一个字符,为’M’ 或’F’; 年龄是一个不大于100的整数输入数据最后有可能有若干个回车,也有可能没有学生不会超过100个,不会出现两个学生的名字仅大小写有差别的情况Output格式和输入数据基本一样,唯一不同在于输出学号的时候,必须用前导0补足8位Sample InputTom Hanks78原创 2021-01-24 11:44:09 · 552 阅读 · 0 评论 -
Encoding
Given a string containing only ‘A’ - ‘Z’, we could encode it using the following method:Each sub-string containing k same characters should be encoded to “kX” where “X” is the only character in this sub-string.If the length of the sub-string is 1, ‘1原创 2021-01-24 11:42:51 · 93 阅读 · 0 评论 -
To and Fro
Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random letters so as to make a rectangular array of letters. For example,原创 2021-01-24 11:42:32 · 141 阅读 · 0 评论 -
map应用:Inglish-Number Translator(map做法)
In this problem, you will be given one or more integers in English. Your task is to translate these numbers into their integer representation. The numbers can range from negative 999,999,999 to positive 999,999,999. The following is an exhaustive list of E原创 2021-01-21 14:21:48 · 209 阅读 · 0 评论 -
map函数常用用法
map翻译为映射,也是常见的STL容器在定义数组时(如int array[100]),其实是定义了一个从int型到int型的映射比如array[0]=25、array[4]=36就分别是将0映射到25、将4映射到36一个double型数组则是将int型映射到double型,如db[0]=3.14,double[1]=0.01但是,无论是什么类型它总是将int型映射到其他类型这似乎表现出一个弊端:当需要以其他类型为关键字来做映射时,会显得不太方便例如有一本字典,上面提供了很多的字符串和对原创 2021-01-19 12:14:16 · 3362 阅读 · 0 评论 -
Excuses, Excuses! map的应用
Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in order to avoid serving. In order to reduce the amount of time required listening to goofy excuses, Judge Ito has asked that you write a program that will searc原创 2021-01-22 23:28:19 · 172 阅读 · 0 评论