牛客423021号 level
获赞
45
粉丝
4
关注
0
看过 TA
3
北京联合大学
2020
C++
IP属地:未知
暂未填写个人简介
私信
关注
2016-09-26 18:13
北京联合大学 C++
0 点赞 评论 收藏
分享
2016-08-10 23:02
北京联合大学 C++
楼主计算机研究生二年级,研究方向存储系统。上周参加了上海华为提前批的校招面试,面试之前先做测评和机考,机考是两道题,限时两个半小时,很简单,一题是根据1900.1.1是星期一,计算出以后某个日期是星期几,另外一题是判断一个数字是不是2的幂次,测评是性格测试,很多很繁杂,反正做到最后我都怀疑自己的性格,结果第二天hr打电话说我测评没过,要重做。。。不过,华为对这次提前批挺重视的,反正我是被打动了。上午专车从学校接人到上研所,接着我们大概30-40多人被安排到一个会议室里听宣讲会,华为几个部门的领导都来讲(无线、终端、2012、云核、***研究院,还有一个忘了),主要讲他们业务、分布、需要的人、有...
crazymind1://华为第一个代码实现 #include<iostream> #include<string> #include<sstream> #include<cmath> #include<algorithm> using namespace std; int a[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; string week[8]={"","Mon","Thes","Wes","Th","Fri","Sat","Sun"}; bool isvalid(int year) { if(year%400==0 || (year%4==0 && year%100!=0))return true; return false; } int main() { string str; while (cin >> str) { string tmp; unsigned int loc = str.find("."); tmp = str.substr(0, loc) + " "; str = str.substr(loc+1); loc = str.find("."); tmp = tmp + str.substr(0, loc) + " "; tmp = tmp + str.substr(loc+1); stringstream ss(tmp); int y, m, d; ss >> y; ss >> m; ss >> d; cout << y << " " << m << " " << d << " "; int totaldays = 0; totaldays = (y-1991)*365; for(int i=1991;i<y;i++) { if(isvalid(i))totaldays++; } for(int i=1;i<m;i++) { totaldays +=a[1]; } if(isvalid(y)&&m>2)totaldays++; totaldays+=d; totaldays = totaldays%7+1; cout<<week[totaldays]<<endl; } cin.get(); return 0; }
投递腾讯等公司9个岗位
0 点赞 评论 收藏
分享

创作者周榜

更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务