首页 > 其他 > 详细

☆1053

时间:2019-02-09 20:26:20      阅读:151      评论:0      收藏:0      [点我收藏+]
  • cmp的编写   return a>b(从大到小)  a<b(从小到大)   
    bool cmp(int a, int b){
    return(Node[a].weight>Node[b].weight);
    }


    sort(Node[parent].child.begin(),Node[parent].child.end(),cmp);//给孩子们排序,从第一个到最后一个孩子

    struct node{
        int x, y;
    }ssd[10];
    
    bool cmp(node a, node b){
      return a.x>b.x;  
    }
    
    node ssd[10];
    sort(ssd, ssd + 10, cmp);  

     

  • set的迭代器不支持小于号,只能用
    for(set<int>::iterator it!=abc.begin();it!=abc.end();it++){}

     

☆1053

原文:https://www.cnblogs.com/flipped415/p/10357927.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!