VIPKID笔试 大数据开发工程师方向 编程题

VIPKID 2020校招 大数据开发工程师在线考试
编程题 | 20.0分1/2
取最优秀的学员
时间限制:C/C++语言 1000MS;其他语言 3000MS
内存限制:C/C++语言 65536KB;其他语言 589824KB
题目描述:
根据不同的数据集判断出最优秀的学生,

PS:题目难易度(简单p1->p5难)

输入
表S,表结构:

st_id bigint comment "学生id"

,st_name varchar(30) comment "学生姓名"

,score int comment "分数"

,pro_type varchar(20) comment "题目类型p1~p5"

,start_time datetime comment "答题开始时间"

输出
最终只输出一条数据,最优秀的学生的学生id和姓名


样例输入
create table S(st_id bigint, st_name varchar(30),score int,pro_type varchar(20),start_time datetime);
insert into S(st_id,st_name,score,pro_type,start_time) values(1,'T',10,'p1','2019-08-22 10:09:13');
insert into S(st_id,st_name,score,pro_type,start_time) values(1,'T',8,'p2','2019-08-22 10:09:17');
insert into S(st_id,st_name,score,pro_type,start_time) values(1,'T',9,'p3','2019-08-22 10:09:37');
insert into S(st_id,st_name,score,pro_type,start_time) values(1,'T',5,'p4','2019-08-22 10:10:25');
insert into S(st_id,st_name,score,pro_type,start_time) values(1,'T',2,'p5','2019-08-22 10:12:30');
insert into S(st_id,st_name,score,pro_type,start_time) values(2,'L',9,'p1','2019-08-22 11:29:22');
insert into S(st_id,st_name,score,pro_type,start_time) values(2,'L',9,'p2','2019-08-22 11:29:30');
insert into S(st_id,st_name,score,pro_type,start_time) values(2,'L',7,'p3','2019-08-22 11:29:53');
insert into S(st_id,st_name,score,pro_type,start_time) values(2,'L',3,'p4','2019-08-22 11:32:20');
insert into S(st_id,st_name,score,pro_type,start_time) values(2,'L',0,'p5','2019-08-22 11:34:07');
insert into S(st_id,st_name,score,pro_type,start_time) values(3,'W',10,'p1','2019-08-22 11:34:03');
insert into S(st_id,st_name,score,pro_type,start_time) values(3,'W',9,'p2','2019-08-22 11:34:08');
insert into S(st_id,st_name,score,pro_type,start_time) values(3,'W',9,'p3','2019-08-22 11:34:26');
insert into S(st_id,st_name,score,pro_type,start_time) values(3,'W',4,'p4','2019-08-22 11:35:01');
insert into S(st_id,st_name,score,pro_type,start_time) values(3,'W',2,'p5','2019-08-22 11:36:12');
insert into S(st_id,st_name,score,pro_type,start_time) values(4,'X',10,'p1','2019-08-22 11:39:10');
insert into S(st_id,st_name,score,pro_type,start_time) values(4,'X',8,'p2','2019-08-22 11:39:17');
insert into S(st_id,st_name,score,pro_type,start_time) values(4,'X',8,'p3','2019-08-22 11:39:41');
insert into S(st_id,st_name,score,pro_type,start_time) values(4,'X',5,'p4','2019-08-22 11:41:15');
insert into S(st_id,st_name,score,pro_type,start_time) values(4,'X',3,'p5','2019-08-22 11:43:59');
样例输出
st_id   st_name
3        W

寻找zero 组数
时间限制:C/C++语言 1000MS;其他语言 3000MS
内存限制:C/C++语言 65536KB;其他语言 589824KB
题目描述:
给定一个整数的数组,找出其中的pair(a,  b),使得a+b=0,并返回这样的pair数目。(a,  b)和(b,  a)是同一组。

输入
 整数数组

输出
找到的pair数目


样例输入
-1,  2,   4,  5,  -2
样例输出
1
暂时只有题目 结束给 代码 两题AC

#VIPKID##笔试题目##大数据开发工程师#
全部评论
第一题我的答案: SELECT temp.st_id AS st_id, temp.st_name AS st_name  FROM ( SELECT st_name, st_id, sum( score ) AS sumSorce, strftime ( '%s', max( start_time ) ) - strftime ( '%s', min( start_time ) ) AS user_time  FROM S  GROUP BY st_name, st_id  ) temp  ORDER BY sumSorce DESC, user_time  LIMIT 1 第二题答案: public class Main {     public static void main(String[] args) {         Scanner scan=new Scanner(System.in);         String lines=scan.nextLine();         String[] arr=lines.split(",");         for(int i=0;i<arr.length;i++){             arr[i]=arr[i].trim();         }         long result=0;         StringBuffer sb=new StringBuffer();         for(int i=0;i<arr.length;i++){             for(int j=0;j<arr.length;j++){                 if(Long.parseLong(arr[i])+Long.parseLong(arr[j])==0 && sb.indexOf(j+"")==-1 && sb.indexOf(i+"")==-1){                     sb.append(i+"&"+j);                     result++;                 }             }         }         System.out.println(result); /*        for(String str:arr){             System.out.println(str);         }*/     } }
点赞 回复 分享
发布于 2019-09-03 18:08
什么叫优秀的学生啊
点赞 回复 分享
发布于 2019-09-03 17:49
一直33% 
点赞 回复 分享
发布于 2019-09-03 17:40
sql 那题一直50%,求解答
点赞 回复 分享
发布于 2019-09-03 17:33
同33,不知道是输入输出有问题还是逻辑。
点赞 回复 分享
发布于 2019-09-03 17:32
寻找0数组,一直33,醉了
点赞 回复 分享
发布于 2019-09-03 17:30
坐等
点赞 回复 分享
发布于 2019-09-03 17:28

相关推荐

不愿透露姓名的神秘牛友
2025-12-17 16:48
今天九点半到公司,我跟往常一样先扫了眼电脑,屁活儿没有。寻思着没事干,就去蹲了个厕所,回来摸出手机刷了会儿。结果老板刚好路过,拍了我一下说上班别玩手机,我吓得赶紧揣兜里。也就过了四十分钟吧,我的直属领导把我叫到小隔间,上来就给我一句:“你玩手机这事儿把老板惹毛了,说白了,你可以重新找工作了,等下&nbsp;HR&nbsp;会来跟你谈。”&nbsp;我当时脑子直接宕机,一句话都没憋出来。后面&nbsp;HR&nbsp;找我谈话,直属领导也在旁边。HR&nbsp;说我这毛病不是一次两次了,属于屡教不改,不光上班玩手机,还用公司电脑看论文、弄学校的事儿。我当时人都傻了,上班摸鱼是不对,可我都是闲得发慌的时候才摸啊!而且玩手机这事儿,从来没人跟我说过后果这么严重,更没人告诉我在公司学个习也算犯错!连一次口头提醒都没有,哪儿来的屡教不改啊?更让我膈应的是,昨天部门刚开了会,说四个实习生里留一个转正,让大家好好表现。结果今天我就因为玩手机被开了。但搞笑的是,开会前直属领导就把我叫去小会议室,明明白白告诉我:“转正这事儿你就别想了,你的学历达不到我们部门要求,当初招你进来也没打算给你这个机会。”合着我没入贵厂的眼是吧?可我都已经被排除在转正名单外了,摸个鱼至于直接把我开了吗?真的太离谱了!
rush$0522:转正名单没进,大概率本来就没打算留你
摸鱼被leader发现了...
点赞 评论 收藏
分享
评论
点赞
9
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务