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

猜你喜欢

转载自www.cnblogs.com/flipped415/p/10357927.html
今日推荐