题解 | #n的阶乘#

小白鼠排队

http://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b

#include<stdio.h>

typedef struct mouse{ int weight; char color[10]; }mouse;

int cmp(const voida,const voidb){ return ((mouse)a).weight<((mouse)b).weight; }

int main (){ int n=0; mouse m[100]; scanf("%d",&n); for (int i=0;i<n;i++){ scanf("%d%s",&m[i].weight,&m[i].color); } qsort(m,n,sizeof(mouse),cmp); for (int i=0;i<n;i++){ printf("%s\n",m[i].color); } return 0; }

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务