全部评论 2

  • std::sort写个 vector 然后写个 cmp 匿名函数输出就可以了

    2023-09-30 来自 四川

    1
    • #include<bits/stdc++.h>
      using namespace std;
      struct q{
      int w[10008];
      }a[10008];
      bool cmp(q x,q y){
      return x.w>y.w;
      }
      int main(){
      int n;
      cin>>n;
      for(int i=0;i<n;i++){

      2023-10-01 来自 河南

      0
    • cin>>a[i].w;
      }
      sort (a,a+n,cmp);
      for(int i=0;i<n;i++){
      cout<<a[i].w<< " " ;
      }
      return 0;
      }

      2023-10-01 来自 河南

      0
    • 可以帮我改一下吗?

      2023-10-01 来自 河南

      0
  • std::sort会吧,普通快排和归并排会吧

    2023-09-30 来自 四川

    0

热门讨论