![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
牛客-华为题库
purple 桐
这个作者很懒,什么都没留下…
展开
-
牛客网——华为机试题库(94-108)
T102. 字符统计 #include<iostream> #include<string> #include<vector> #include<unordered_map> #include<algorithm> using namespace std; bool cmp(pair<char,int> a, pair<char,int> b){ if(a.second!=b.second) {原创 2020-08-21 14:02:02 · 1118 阅读 · 0 评论 -
牛客——华为机试
T15. 求int型数据在内存中存储时1的个数 #include <iostream> using namespace std; int main() { int n; cin >> n; int num = 0; for(int i = 0; i <= 32; i++) { if(n & (1 << i)) num++; } cout <&l原创 2020-08-03 12:03:12 · 461 阅读 · 0 评论 -
牛客网——华为机试题库(31-40)
31、单词倒排 #include <iostream> #include <vector> using namespace std; int main() { string str; while(getline(cin, str)) { vector<string> word; string temp = ""; for(int i = 0; i < str.size(); i ++)原创 2020-07-11 20:09:16 · 698 阅读 · 0 评论 -
牛客网——华为机试题库(21-30)
21、简单密码 #include <iostream> #include <string.h> using namespace std; int main() { string str; while(cin >> str) { //进行加密 //小写字母变成九宫格数字 // 1--1, abc--2, def--3, ghi--4, jkl--5, mno--6, pqrs--7, tuv--8 w原创 2020-07-08 14:16:31 · 434 阅读 · 0 评论 -
牛客网——华为机试题库(11-20)
11、数字颠倒 #include <iostream> using namespace std; int main() { int n; cin >> n; string str; while(n != 0) { char c = n % 10 + '0'; n /= 10; str += c; } cout << str << endl;原创 2020-07-07 09:12:38 · 739 阅读 · 0 评论 -
牛客网——华为机试题库(1-10)
1、字符串最后一个单词的长度 #include <iostream> #include <string.h> using namespace std; int main() { char str[5001]; //输入字符串 //cin >> str;//错的,遇到空格不读了 //cin不接受空格,TAB等键的输入,遇到这些键,字符串会终止,而gets()则接受连续的输入,包括空格,TAB gets(str); int l原创 2020-07-06 11:48:25 · 1868 阅读 · 0 评论