徐尚Alan
徐尚Alan
全部文章
分类
归档
标签
去牛客网
登录
/
注册
徐尚Alan的博客
TA的专栏
29篇文章
0人订阅
华为机试题解
29篇文章
53人学习
全部文章
(共52篇)
题解 | 计算某字符出现次数
相关知识获取字符串中某字符出现次数最简便的方法是什么? 使用std::count(InputIterator first, InputIterator last, const Tp &value)。在这道题中,表现为count(s.begin(), s.end(), c)或者count(s....
2025-09-10
0
29
题解 | 字符串最后一个单词的长度
相关知识getline()和cin适用的场景分别是什么? 如果你要读取一整行字符串,特别是包含空格的字符串,那么应该用getline(),因为getline()停止的标志是换行符。如果你要读取单个变量,那么应该用cin,因为cin停止的标志除了换行符,还有分隔符(空格和缩进)。如果你在cin 后接 ...
2025-09-10
0
44
题解 | 小红书推荐系统
第一轮第一版(不完整) #include <algorithm> #include <iostream> #include <sstream> #include <string> #include <unordered_map> #incl...
2025-09-08
0
43
题解 | 小苯送礼物
第一轮第一版(0/10) #include <algorithm> #include <iostream> #include <vector> using namespace std; struct Fans{ int id; int like;...
2025-09-08
0
43
题解 | 分数线划定
第一轮第一版(编译错误) #include <algorithm> #include <iostream> #include <map> #include <string> #include <unordered_map> #include...
2025-09-08
0
29
题解 | 计算某字符出现次数
第一轮最后一版(AC) #include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; int main() { ...
2025-09-07
0
31
题解 | 字符串最后一个单词的长度
第一轮最后一版(AC) #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; int main() { ...
2025-09-07
0
28
题解 | DNA序列
第一版(2/10) #include <iostream> #include <string> #include <vector> using namespace std; // 写一个函数计算字符串中的GC比例 double gcRatio(const st...
2025-09-06
0
30
题解 | 找出字符串中第一个只出现一次的字符
第一版(AC) #include <iostream> #include <vector> using namespace std; int main() { // 我们用一个数组来记录每个小写字母出现的次数 // 在符合条件的字母里我们从头找第一个符合要求...
2025-09-06
0
44
题解 | 字符串加解密
第一版(0/21) #include <iostream> using namespace std; string process1(string& a) { for (char c : a) { if ((c >= 'a' && ...
2025-09-06
0
26
首页
上一页
1
2
3
4
5
6
下一页
末页