首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
本兮言✨
滴滴出行_橙心优选事业部_开发工程师
北京理工大学珠海学院
2018届
golang工程师
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(6)
求 n 个数中的最大值和最小值,最少的比较次数是?
3
首先,把2n中进行两两比较,比较n次,大的放到A,小的放到B 然后把A和B中进行组内比较 比较2(n-1) 所以结果就是n+2(n-1)=3n-2
发表于 2018-03-31 11:33:03
矩形覆盖
0
说一下我的思路吧,简单快捷 首先总共有2*n的大矩形由n个2*1的小举行摆 比如要放n=8的时候 1.可以横着放剩余的n(也就是空着的位置为) n=6 2.可以竖着放,剩余的n n=7 所以得出来 f(8)=f(7)+f(6) 所以代码为: function rectCover($number) {...
发表于 2018-01-23 16:12:51
科学计数法 (20)
3
简洁.易懂 欢迎参考 #include<iostream> #include<stdlib.h> #include<string> using namespace std; int main() { string N; cin>>N; int...
发表于 2017-12-01 15:03:52
月饼 (25)
1
#include<iostream> #include<stdlib.h> #include<algorithm> #include<vector> using namespace std; struct M{ double s; double...
发表于 2017-11-29 18:16:53
德才论 (25)
0
#include<iostream> #include<vector> #include<algorithm> using namespace std; struct student{ int num; int level,score_d,score_c; i...
发表于 2017-11-27 23:31:33
数字分类 (20)
0
#include<iostream> #include<iomanip> using namespace std; int main() { int n; cin>>n; int A1=0,A2=0,A3=0,A5=0,A4Num=0...
发表于 2017-11-26 16:55:48
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题