☆1053

  • 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++){}

     

posted on 2019-02-09 20:01  Vitavi  阅读(115)  评论(0编辑  收藏  举报

导航