0
已解决
颜咏春
中级光能
中级光能
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct st { char name[51] ; char sc[501] ; }st ; st a[501] ; int comp( const void *a , const void *b ) { if( strlen( ((st *)a)->sc ) != strlen( ((st *)b)->sc ) ) return strlen( ((st *)b)->sc ) - strlen( ((st *)a)->sc ) ; return strcmp( ((st *)b)->sc , ((st *)a)->sc ) ; } int main() {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct st
{
char name[51] ;
char sc[501] ;
}st ;
st a[501] ;
int comp( const void *a , const void *b )
{
if( strlen( ((st *)a)->sc ) != strlen( ((st *)b)->sc ) )
return strlen( ((st *)b)->sc ) - strlen( ((st *)a)->sc ) ;
return strcmp( ((st *)b)->sc , ((st *)a)->sc ) ;
}
int main()
{
//freopen("in.txt","r", stdin) ;
int n , i ;
scanf("%d", &n ) ;
for( i = 0 ; i < n ; ++i )
{
scanf("%s%s", a[i].name , a[i].sc ) ;
}
qsort( a , n , sizeof(a[0]) , comp ) ;
for( i = 0 ; i < n ; ++i )
puts( a[i].name ) ;
return 0 ;
}
int n , i ; scanf("%d", &n ) ; for( i = 0 ; i < n ; ++i ) { scanf("%s%s", a[i].name , a[i].sc ) ; } qsort( a , n , sizeof(a[0]) , comp ) ; for( i = 0 ; i < n ; ++i ) puts( a[i].name ) ; return 0 ; }
0
0
0
0
0
0
0
0
丁振轩
资深光能
资深光能
??????????????????????????????????????????????????????????????????????????????
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0