![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sort
木白星枝
这个作者很懒,什么都没留下…
展开
-
sort函数的用法
#include<iostream>#include<algorithm>using namespace std;bool complare(int a,int b){ return a<b; //升序 return a>b; //降序}int main(){ int a[10]= {9,6,3,8,5,2...原创 2019-06-03 10:10:19 · 149 阅读 · 0 评论 -
关于结构体的sort函数的用法
引入一个问题:链接:https://ac.nowcoder.com/acm/contest/911/D来源:牛客网有 n件商品,第 i件商品价格为 a[i],购买后,其它所有未购买的商品价格乘上 p[i],现在要买下所有商品,输出最小耗费。题目分析:判断2件商品商品先买哪一件,这两件商品买完后对剩余商品的折扣不便,所以这2商品的先后顺序不会对后面有所影响,所以我们只需根据当前的汇...原创 2019-06-03 11:40:57 · 1338 阅读 · 0 评论