人间醉得意
人间醉得意
全部文章
分类
题解(14)
归档
标签
去牛客网
登录
/
注册
人间醉得意的博客
全部文章
(共14篇)
题解 | #记票统计#
#include <iostream> #include <vector> #include <string> #include <set> using namespace std; int main() { int personNun =...
C++
哈希表
2021-12-27
0
204
题解 | #在字符串中找出连续最长的数字串#
1、循环比较查找为数字字符并且存入到一个字符串中,采用multimap存放对应字串与长度,并通过大小排序; 2、将排序后的map中的子串有相同长度的合并输出,用一个vcetor转存一次方便输出; #include <iostream> #include <map> #incl...
C++
字符串
哈希表
2021-12-24
0
281
题解 | #字符串字符匹配#
1、用第一个输入的字符串的字符依次去第二次输入的字符串中查找 #include <iostream> #include <string> using namespace std; int main() { string str; while (cin &g...
C++
字符串
2021-12-22
0
296
题解 | #整型数组合并#
1、set容器将两次输入的数据插入, 默认去重升序排序 #include<iostream> #include <set> using namespace std; int main() { int n1 = 0; set<int> s1; ...
C++
数组
2021-12-22
1
299
题解 | #输入n个整数,输出其中最小的k个#
1、主要是考点是输入,怎么输入 这两行数字 #include <iostream> #include <vector> #include<algorithm> using namespace std; int main() { int numCnt =...
C++
数组
2021-12-22
1
290
题解 | #坐标移动#
1、思路很清晰,找到匹配的字符ADSW然后再找出后面符合要求的字符数字即可; #include <iostream> #include <string> using namespace std; int LenRecord(int& i, string str) ...
C++
字符串
2021-12-21
0
261
题解 | #字符串最后一个单词的长度#
1、采用string 获取整个字符串的长度,在反向查找第一个空格的position,用长度减去position(从0计数)再加上1; #include <iostream> #include <string> using namespace std; int main() ...
C++
字符串
2021-12-21
0
212
题解 | #删除字符串中出现次数最少的字符#
1、 规定输入的全是小写字符,定义一个长度为26的数组,将输入字符串中的字符个数统计存于数组中; 2、比较求出数组中最小的值即为出现次数最少的字符; 3、循环比较字符串中字符的在数组中的次数大于最小次数的则输出该字符; #include <iostream> #include <s...
C++
字符串
2021-11-24
3
285
题解 | #简单密码#
直接上代码: #include <iostream> #include <string> #include <map> using namespace std; int main() { map<string, char> mStr = {...
C++
字符串
2021-11-22
0
279
题解 | #密码验证合格程序#
1、 主要是第三个条件:要不能有重复的子串且子串的长度>2,这一点 可以转为为最小长度=3的子串是否在字符串中存在重复;这样就很好解决了,将所有字串存储在set中直接查找重复的字串; #include <iostream> #include <string> #incl...
C++
字符串
哈希表
2021-11-22
0
274
首页
上一页
1
2
下一页
末页