sscanf的使用 HDU 2093
来源:互联网 发布:linux 终端输入中文 编辑:程序博客网 时间:2024/06/16 05:01
#include<stdio.h>#include<stdlib.h>#include<string.h> struct c{ char name[20]; int x;//名次 int y;//时间}d[1000];int comp(const void *a,const void *b){ struct c *p1=(struct c *)a; struct c *p2=(struct c *)b; if(p1->x!=p2->x) return -(p1->x-p2->x); else if(p1->y!=p2->y) return p1->y-p2->y; else return strcmp(p1->name,p2->name);}int main(){ char str[10]; int a,b,i,t; int n,m,j=0; struct c d[1000]={0}; scanf("%d %d",&n,&m); while(scanf("%s",d[j].name)!=EOF) { for(i=0;i<n;i++) { scanf("%s",str); t=sscanf(str,"%d(%d)",&a,&b); if(t==2) { d[j].y=d[j].y+b*m+a; d[j].x++; } else if(t==1 && a>0) { d[j].x++; d[j].y=d[j].y+a; } } j++; } qsort(d,j,sizeof(struct c),comp); for(i=0;i<j;i++) { printf("%-10s %2d %4d\n",d[i].name,d[i].x,d[i].y); } return 0;}
0 0
- sscanf的使用 HDU 2093
- sscanf函数的使用
- sscanf的使用
- sscanf 函数的使用
- sscanf函数的使用
- sscanf的使用
- 警惕sscanf的使用
- sscanf的使用
- sscanf的使用
- sscanf的使用
- sscanf的使用
- sscanf的高级使用
- sprintf() sscanf()的使用
- sscanf函数的使用
- sscanf和sstream的使用
- sprintf(),sscanf()函数的使用
- 关于sscanf函数的使用
- hdu 2206IP的计算(sscanf的使用 & 字符串判断处理)
- java常用误区
- android webview 通过html5播放在线视频 切换大屏
- KindEditor富文本编辑器 items配置项 对照表
- poj 3370 Halloween treats (组合数学:鸽巢原理)
- 怎么样产生和捕获SUGUSR信号??
- sscanf的使用 HDU 2093
- Qt 调用 VC(CUDA)制作的dll
- Table 组件使用指南之十五:使用POJO绑定并实现排序与过滤功能
- C++类与C#类区别详述
- C语言的一个正则表达式pcre
- C语言模拟String对象类型
- Table 组件使用指南之十六:动态增加Column
- Highchart学习资源
- HTTP协议笔记