HDU 1052 Tian Ji -- The Horse Racing
来源:互联网 发布:一致预期数据 编辑:程序博客网 时间:2024/05/05 10:28
#include<stdio.h>#include<stdlib.h>int cmp(const void *a,const void *b){return *(int *)b-*(int *)a;}int main(){int n,a[1010],b[1010],i,j,win,lose,k1,k2;while(scanf("%d",&n)&&n){for(i=0;i<n;i++)scanf("%d",&a[i]);for(i=0;i<n;i++)scanf("%d",&b[i]);qsort(a,n,sizeof(a[0]),cmp);qsort(b,n,sizeof(b[0]),cmp);k1=k2=n;for(i=0,win=0,lose=0,j=0;i<k1;){if(a[i]>b[j]){j++;win++;i++;}else if(a[i]<b[j]){j++;k1--;lose++;}else if(a[k1-1]>b[k2-1]){k2--;k1--;win++;}else if(a[k1-1]<b[k2-1]){j++;k1--;lose++;}else{j++;k1--;if(a[k1]<b[j-1])lose++;else if(a[k1]>b[j-1])win++;}}printf("%d\n",200*(win-lose));}return 0;}
- HDU 1052 Tian Ji -- The Horse Racing
- HDU 1052 Tian Ji -- The Horse Racing
- HDU 1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- HDU 1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- hdu - 1052 - Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- hdu-1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- HDU 1052 Tian Ji -- The Horse Racing
- hdu 1052 Tian Ji -- The Horse Racing
- HDU 1052 Tian Ji -- The Horse Racing
- hdu-1052Tian Ji -- The Horse Racing
- HDU - 1052 Tian Ji -- The Horse Racing
- hdu-1052-Tian Ji -- The Horse Racing
- Struts2的Result Type
- 有名管道FIFO的读写
- Could not bind factory to JNDI
- UIView的各种动画详解
- JS操作struts标签问题
- HDU 1052 Tian Ji -- The Horse Racing
- 百度编程大赛的9宫图代码及解析
- 《学习OpenCV》第二章(2)
- mysql中如何安装innodb plugin
- python中文注释报错问题
- png转ico 或如何制作ico文件
- 各路高手,求帮助
- S2SH学习笔记(1)----Struts2,Hibernate,Spring自定义配置文件路径
- latch详解——转自itpub精华帖(引)