大家来吐槽一下华为的笔试吧

RT,今晚的笔试简直爆炸,第二题输入输出是什么鬼,第三题没看懂。。。

顺便问一下,多少分能有面试机会?
#华为#
全部评论
都sp了还在这里吐槽。。。唉。。。
2 回复 分享
发布于 2017-08-28 10:59
华为机试100分就算过,剩下的看面试表现。只要总分算出来有100分就有面试机会,如果学校比较好的话。分值大约为该题分值乘以通过率,累加,所以往年就算只有第一题全ac,也是可以面试的
点赞 回复 分享
发布于 2017-08-16 22:03
// 贴个代码吧... #ifdef LOCAL #include <fstream> #endif //#ifdef LOCAL #include <cstdio> #include <cstring> #include <map> #include <queue> #include <unordered_map> #include <vector> //#else //#include <bits/stdc++.h> //#endif #define INF 0x7FFFFFFF using namespace std; typedef long long LL; inline void read(LL&a){char c;while(!(((c=getchar())>='0')&&(c<='9')));a=c-'0';while(((c=getchar())>='0')&&(c<='9'))(a*=10)+=c-'0';} class Dependency { public: void AddDependency(unsigned int ModuleId, unsigned int DependModuleId) { if (degree.find(ModuleId) == degree.end()) { degree[ModuleId] = 0; } if (degree.find(DependModuleId) == degree.end()) { degree[DependModuleId] = 0; } ++degree[DependModuleId]; Graph[ModuleId].push_back(DependModuleId); } void CalcDependency() { for (map<int, int>::iterator it = degree.begin(); it != degree.end(); ++it) { if (it->second == 0) { que.push(it->first); degree[it->first] = -1; } } while (!que.empty()) { int x = que.front(); que.pop(); for (int i = 0; i < Graph[x].size(); ++i) { --degree[Graph[x][i]]; if (degree[Graph[x][i]] == 0) { que.push(Graph[x][i]); degree[Graph[x][i]] = -1; } } } } bool MouldelsCycularDependency(unsigned int ModuleId) { if (degree[ModuleId] > 0) return false; return true; } void clear(void) { degree.clear(); Graph.clear(); } queue<int> que; map<int, int> degree; unordered_map<int, vector<int>> Graph; }; int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); #endif Dependency dep; int a, b; while (scanf("{%x, %x}", &a, &b) != EOF) { dep.AddDependency(a, b); char ch = getchar(); if (ch != ',') break; getchar(); } dep.CalcDependency(); vector<pair<int, int>> ans; for (map<int, int>::iterator iter = dep.degree.begin(); iter != dep.degree.end(); ++iter) { //if (iter->second > 0) printf("(0x%.02x, true)\n", iter->first); //else printf("(0x%.02x, false)\n", iter->first); ans.push_back(make_pair(iter->first, iter->second)); } for (int i = 0; i < ans.size(); ++i) { if (ans[i].second != -1) printf("{0x%.02x, true}", ans[i].first); else printf("{0x%.02x, false}", ans[i].first); if (i != ans.size()-1) printf(",\n"); else printf("\n"); } return 0; }
2 回复 分享
发布于 2017-08-16 21:09
第二题 //用弗洛伊德算法思想 #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> using namespace std; vector<int> label; vector<int> dataIndex; void AddDependency(unsigned int Moduled, unsigned int DeModuled) { for(int i = 0; i < label.size(); ++i) { if(Moduled == label[i]) { dataIndex.push_back(Moduled); break; } } for(int j = 0; j < label.size(); ++j) { if(DeModuled == label[j]) { dataIndex.push_back(DeModuled); break; } } } int main() { vector<string> input; vector<int> result; string temp; while(getline(cin, temp)) { input.push_back(temp); } int len = input.size(); for(int i = 0; i < len; i++) { temp = input[i]; int k = 3; int num = 0; while(temp[k] != ',') { if(temp[k] >= '0' && temp[k] <= '9') { num = num * 16 + temp[k] - '0'; k++; } else { num = num * 16 + temp[k] - 'a'; k++; } } result.push_back(num); num = 0; k = k + 4; while(temp[k] != '}') { if(temp[k] >= '0' && temp[k] <= '9') { num = num * 16 + temp[k] - '0'; k++; } else { num = num * 16 + temp[k] - 'a'; k++; } } result.push_back(num); num = 0; } vector<int> result_temp(result); sort(result_temp.begin(), result_temp.end()); label.push_back(result_temp[0]); for(int i = 1; i < result_temp.size(); i++) { if(result_temp[i] != result_temp[i-1]) label.push_back(result_temp[i]); } for(int i = 0; i < result.size()-1; i += 2) { AddDependency(result[i], result[i+1]); } int **arr = new int*[label.size()]; for(int i = 0; i < label.size(); i++) arr[i] = new int[label.size()]; //初始化数组为全0; for(int i = 0; i < label.size(); i++) for(int j = 0; j < label.size(); j++) arr[i][j] = 0; for(int i = 0; i < result.size()-1; i += 2) { arr[dataIndex[i]-1][dataIndex[i+1]-1] = 1; } for(int i = 0; i < label.size(); i++) { for(int j = 0; j < label.size(); j++) { for(int k = 0; k < label.size(); k++) { if(arr[j][i] == 1 && arr[i][k] == 1) { arr[j][k] = 1; } } } } //输出的格式没有调 for(int i = 0; i < label.size(); ++i) { if(arr[i][i] == 1) cout << label[i] << endl; } //最后需要释放内存 return 0; }
点赞 回复 分享
发布于 2017-08-17 17:07
现在笔试的是优招的吗?
1 回复 分享
发布于 2017-08-17 12:05
100 80第三题太长不看
点赞 回复 分享
发布于 2017-08-16 21:25
第一题本地通过,但牛客上始终0%,不知道什么鬼,看来面试机会都没有了
4 回复 分享
发布于 2017-08-16 21:16
华为笔试是在牛客还是在赛码
点赞 回复 分享
发布于 2020-08-23 14:49
SP大佬
点赞 回复 分享
发布于 2017-09-01 11:49
模块依赖关系分析    点击链接查看源码
点赞 回复 分享
发布于 2017-08-18 15:21
我怎么没收到笔试通知,是某个岗位吗
点赞 回复 分享
发布于 2017-08-18 00:33
华为不是号称过了一题就可以面试了吗
点赞 回复 分享
发布于 2017-08-17 23:56
#include #include #include #include #include #include #include #include #include using namespace std; set nodeset; vector > a; // set> m; // edge map mm; unordered_map visited; void AddDependency(unsigned int ModuleId, unsigned int DependModuleId) { m.insert(make_pair(ModuleId, DependModuleId)); } bool ModulesCycularDependency(unsigned int ModuleId) { int n = nodeset.size(); vector d; d.push_back((int)ModuleId); visited[ModuleId] = 1; while (!d.empty()) { int i = d.back(); d.pop_back(); for (int k = 0; k < a[i].size(); k++) { if (!visited.count(a[i][k])) { visited[a[i][k]] = 1; d.push_back(a[i][k]); } else { if (a[i][k] == ModuleId) { string output = (string)mm[ModuleId]; std::cout << output << " is false" << std::endl; visited.clear(); return true; } } } } string output = (string)mm[ModuleId]; std::cout << output << " is true" << std::endl; visited.clear(); return false; } void clear(void) { } int main() { string in; int count = 0; while(getline(cin, in), in != "") { size_t pos = in.find_first_of(','); if (pos != std::string::npos) { if (in[in.size() - 1] == ',') { int x = std::stoul(in.substr(1, pos - 1), nullptr, 16); int y = std::stoul(in.substr(pos+2, in.size() - 4 - pos), nullptr, 16); nodeset.insert(x); nodeset.insert(y); mm.insert(make_pair(x, in.substr(1, pos - 1))); mm.insert(make_pair(y, in.substr(pos + 2, in.size() - 4 - pos))); m.insert(make_pair(x, y)); //node.push_back(in.substr(1, pos - 1)); //node.push_back(in.substr(pos + 2, in.size() - 4 - pos)); } else { int x = std::stoul(in.substr(1, pos - 1), nullptr, 16); int y = std::stoul(in.substr(pos+2, in.size() - 3 - pos), nullptr, 16); nodeset.insert(x); nodeset.insert(y); mm.insert(make_pair(x, in.substr(1, pos - 1))); mm.insert(make_pair(y ,in.substr(pos + 2, in.size() - 3 - pos))); m.insert(make_pair(x, y)); } } if (in[in.size() - 1] != ',') break; } a.assign((int)nodeset.size(), vector()); for (auto& x : m) { a[x.first].push_back(x.second); } for (int i = 0; i < nodeset.size(); i++) { ModulesCycularDependency(i); } return 0; }
点赞 回复 分享
发布于 2017-08-17 22:21
class Main5 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); List<String> list = new ArrayList<>(); while (scanner.hasNext()) { String line = scanner.nextLine(); list.add(line); if (!line.endsWith(",")) { break; } } TreeSet<String> set = new TreeSet<>(); for (String pair : list) { String[] tmp = pair.split(",|\\{|\\}"); AddDependency(tmp[1].trim(), tmp[2].trim()); set.add(tmp[1].trim()); set.add(tmp[2].trim()); } int i = 0; for (String str : set) { if (i == set.size() - 1) { System.out.println("{" + str + ", " + MouldIsCircularDependency(str) + "}"); } else { i++; System.out.println("{" + str + ", " + MouldIsCircularDependency(str) + "},"); } } } static Map<String, ListNode> map1 = new HashMap<>(); static Map<String, ListNode> map2 = new HashMap<>(); public static void AddDependency(String moduleId, String dependModuleId) { if (map1.containsKey(moduleId)) { if (map2.containsKey(dependModuleId)) { ListNode l1 = map1.get(moduleId); ListNode l2 = map2.get(dependModuleId); l1.next = l2; } else { ListNode l1 = map1.get(moduleId); ListNode l2 = new ListNode(dependModuleId); l1.next = l2; map1.put(dependModuleId, l2); } } else { if (map2.containsKey(dependModuleId)) { ListNode l1 = new ListNode(moduleId); ListNode l2 = map2.get(dependModuleId); l1.next = l2; map1.put(moduleId, l1); } else { ListNode l1 = new ListNode(moduleId); ListNode l2 = new ListNode(dependModuleId); l1.next = l2; map1.put(moduleId, l1); map1.put(dependModuleId, l2); map2.put(dependModuleId, l2); map2.put(moduleId, l1); } } } private static boolean MouldIsCircularDependency(String moduleId) { for (Map.Entry<String, ListNode> entry : map1.entrySet()) { ListNode ring = detectCycle(entry.getValue()); ListNode curr = ring; boolean isFirst = true; while (curr != null && (curr != ring || isFirst)) { isFirst = false; if (curr.val.equals(moduleId)) { return true; } curr = curr.next; } } return false; } static void clear() { map1.clear(); map2.clear(); } public static ListNode detectCycle(ListNode head) { if (head == null || head.next == null) { return null; } ListNode fast = head, slow = head; while (true) { if (fast == null || fast.next == null) { return null; } slow = slow.next; fast = fast.next.next; if (fast == slow) { break; } } slow = head;//slow back to start point while (slow != fast) { slow = slow.next; fast = fast.next; } return slow; //when slow == fast, it is where cycle begins } } class ListNode { String val; ListNode next; ListNode(String val) { this.val = val; this.next = null; } }
点赞 回复 分享
发布于 2017-08-17 20:09
#第三题 ac letterlist = "1234567890qwertyuiopasdfghjklzxcvbnm&=+$,;?/-_.!~*'()#QWERTYUIOPASDFGHJKLZXCVBNM" string = raw_input() start = 0 end = 0 result = [] last_end = -1 for i in range(len(string)): if string[i] == "@": start = i continue if string[i] == ".": end = i if (end - start + 1 - 2) <= 119: start3 = start - 3 # print start3 if start3 < 0 or start3 <= last_end: last_end = end continue else: last_end = end test_string = string[start3:start] flag = 0 for letter in test_string: if letter not in letterlist and letter != "@": flag = 1 if (flag == 1): continue else: result.append(start3) result.append(start3+1) result.append(start3+2) else: continue final = "" for i in range(len(string)): if i in result: final += "*" else: final += string[i] print final
点赞 回复 分享
发布于 2017-08-17 20:06
#第二题 ac trans = {"a":10,"b":11,"c":12,"d":13,"e":14,"f":15} result = {} seen = {} find = 0 def get_id(string): count = 0 for i in string: if i in trans: i = trans[i] else: i = int(i) count = count * 16 + i return count def start1(start,key): global find,seen if key in result: # print start,"key_list:",result[key]["after"] if start in result[key]["after"]: find = 1 else: for item in result[key]["after"]: # print "in",item if not seen[item]: seen[item] = True start1(start,item) def clear(): global seen for key,value in seen.items(): seen[key] = False # count = 0 while True: flag = 1 data = raw_input() if "}," not in data: flag = 0 id1 = data.split(",")[0].replace("{","").strip() id2 = data.split(",")[1].replace("}","").replace(",","").strip() if id1 in result: result[id1]["after"].append(id2) else: result[id1] = {"index":get_id(id1.replace("0x","")),"after":[id2]} if id2 not in result: result[id2] = {"index":get_id(id2.replace("0x","")),"after":[]} if id1 not in seen: seen[id1] = False if id2 not in seen: seen[id2] = False if flag == 0: break # print count result_list = [] for key,value in result.items(): # print key clear() seen[key] = True start1(key,key) # print "find",find if find == 0: result_list.append([value["index"],key,"false"]) else: result_list.append([value["index"],key,"true"]) find = 0 this_count = 0 for item in sorted(result_list,key = lambda x:x[0]): this_count += 1 # print this_count if (this_count == len(result_list)): print "{"+item[1]+", "+item[2]+"}" else: print "{"+item[1]+", "+item[2]+"},"
点赞 回复 分享
发布于 2017-08-17 20:05
你哪里的 怎么笔试了 我投简历 一点消息都没有啊
点赞 回复 分享
发布于 2017-08-17 16:58
华为优招面试官跟我说你们怎么笔试都是600分  是不是太简单了  看来要加大难度了
点赞 回复 分享
发布于 2017-08-17 16:36
所以说,华为是很看重学校的
点赞 回复 分享
发布于 2017-08-17 16:31
别紧张啊各位..我814面试的时候现场聊天遇到好几个0分也被通知来面试的啦
点赞 回复 分享
发布于 2017-08-17 11:30

相关推荐

03-17 19:21
门头沟学院 Java
面试官_我太想进步了:正常企查查显示的员工一般比设计的少
点赞 评论 收藏
分享
评论
点赞
5
分享

创作者周榜

更多
牛客网
牛客企业服务