Austin_zhai
Austin_zhai
全部文章
分类
题解(18)
归档
标签
去牛客网
登录
/
注册
Austin_zhai的博客
全部文章
(共54篇)
题解 | #生成列表#
定义接收变量与列表变量,在接收输入的同时,将字符串按照空格进行分割 name = input().split(" ") name_list = list() 利用for循环将接收到的字符串写入空列表并打印 for i in name: name_list.append(i...
Python3
2022-08-03
39
594
题解 | #十六进制数字的大小#
先接收所需输入的十六进制数 number = input() 利用int的功能进行十六进制转十进制的转换 print(int(number,16))
Python3
2022-08-02
5
382
题解 | #牛牛的小数输出#
将接收数字进行数据格式转换,input默认接收后为str类型 number = float(input()) 利用格式化输出打印需要的结果 print("%.2f" % number)
Python3
2022-08-02
1
266
题解 | #得分不小于平均分的最低分#
计算不得小于平均分的最低分数,要点就在于如何将分数与平均分做比较,此处比较推荐在where字句中进行条件判断,虽然在where子句中使用select查询会降低查询效率,但只要数据量不大,也是可以使用的。 select min(e1.score) min_score_over_avg from e...
Mysql
2022-07-18
0
254
题解 | #统计作答次数#
乍一看是挺简单的一题,好像只需要计算出各个字段的count值即可,这里有一个坑,就是当没完成交卷的次数不计入计数的时候,三个字段就无法通过where去进行筛选,这里使用if对单个需要不计算非交卷的个数进行排除即可。 select count(*) total_pv, count(submit_ti...
Mysql
2022-07-18
0
253
题解 | #SQL类别高难度试卷得分的截断平均值#
求截断平均值,按照题目的要求我们直接去掉exam_id为9001中的最高值和最低值再求平均数即可。 select tag,difficulty,t.clip_avg_score from (select round(((sum(score)-max(score)-min(score))/(cou...
Mysql
2022-07-16
0
266
题解 | #修改表#
根据要求对指定位置增加字段、变更字段名称及属性、修改默认值与备注进行操作 alter table user_info add column school varchar(15) after level, change job profession varchar(10), modify achie...
Mysql
2022-07-15
0
256
题解 | #创建一张新表#
根据题目所提供的每个字段的信息,创建对应的字段、类型、限制、默认值、注释 create table if not exists user_info_vip( id int(11) primary key auto_increment comment '自增ID', uid int...
Mysql
2022-07-15
0
284
题解 | #删除记录(一)#
这里的记录有一条是时差在4分59,故不适合使用timediff进行精确判断,此处使用时间戳判断更为适合 delete from exam_record where timestampdiff(minute,start_time,submit_time)<5 and score<60;
Mysql
2022-07-14
0
185
题解 | #返回每个顾客不同订单的总金额#
通过提示使用sum进行总订单额的计算,并将结果作为表带入到查询中进行排序筛选 select cust_id, t.total_ordered from (select sum(item_price*quantity) total_ordered, order_num from OrderI...
Mysql
2022-07-13
0
264
首页
上一页
1
2
3
4
5
6
下一页
末页