题解 | 最差是第几名(二)

最差是第几名(二)

https://www.nowcoder.com/practice/165d88474d434597bcd2af8bf72b24f1

with rk_table as (select
grade,
sum(number) over(order by grade) t_rank
from
class_grade),
start_end as (with total_table as (select sum(number) as total from class_grade)
select 
case when total % 2 = 0 then floor(total / 2) else  floor(total / 2) + 1 end start,
floor(total / 2) + 1  end
from total_table)
select min(grade) from rk_table, start_end
where t_rank >= start
union
select min(grade) from rk_table, start_end
where t_rank >= end

全部评论

相关推荐

2025-12-15 11:27
门头沟学院 Java
哇哇的菜鸡oc:所有人不要理会,就好了,后面他就知道怎么回事了,只能说有的时候市场都是被宰的人搞坏的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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