#19819: C++ sort+compare


jack621224 (YJLegend)


使用comp來sort

bool comp(int a, int b){
     if(a%10==b%10) return a>b;
     else return a%10<b%10;
}

 

sort(arr, arr+n, comp);

 

剛學會compare覺得酷

#20633: Re:C++ sort+compare


babylinlin (babylinlin)


使用comp來sort

bool comp(int a, int b){
     if(a%10==b%10) return a>b;
     else return a%10<b%10;
}

 

sort(arr, arr+n, comp);

 

剛學會compare覺得酷



你的眼睛背叛了你的心~~~~~~