大三下

现在是否还有实习生招聘?
全部评论
直接投,这种时候只能看运气了
2
送花
回复 分享
发布于 06-11 22:08 辽宁

相关推荐

头像 会员标识
07-22 20:09
西南大学 C++
小红书有一个推荐系统,可以根据用户搜索的关键词推荐用户希望获取的内容。现在给定小红的搜索记录(记录为分词后的结果),我们认为当一个单词出现的次数不少于3次时,该单词为“用户期望搜索的单词”,即称为关键词。请你根据小红的记录,输出小红的用户画像对应的所有关键词。时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 256M,其他语言512M输入描述:一行字符串,仅由小写字母和空格组成。代表小红的搜索记录。字符串长度不超过100000。输出描述:小红所有的关键词。每行输入一个。你需要按照搜索频次从高到低输出。频次相同的,你需要按字典序升序输出。示例1输入例子:kou red game red ok who game red karaoke yukari kou red red nani kou can koukou ongakugame game输出例子:redgamekou#include <iostream>#include<algorithm>#include<vector>#include<map>using namespace std;struct mapcomparator {    bool operator()(const std::pair<string, int>& a, const std::pair<string, int>& b) {        if (a.second == b.second) {            return a.first < b.first;        }        return a.second > b.second;    }};int main() {    string a;    map<string, int> wmap;    while (cin >> a) { // 注意 while 处理多个 case        wmap[a] ++;    }    vector<std::pair<string,int>> sortMap(wmap.begin(), wmap.end());    std::sort(sortMap.begin(), sortMap.end(), mapcomparator());    auto it = sortMap.begin();    while(it!=sortMap.end()){        if(it->second > 2){            cout<< it->first <<endl;        }        it++;    }}// 64 位输出请用 printf("%lld")
查看2道真题和解析 投递小红书等公司10个岗位
点赞 评论 收藏
分享
7 1 评论
分享
牛客网
牛客企业服务