【继续找状态做简单题】HDU 1052 Tian Ji -- The Horse Racing
来源:互联网 发布:美工常用的网站 编辑:程序博客网 时间:2024/06/05 13:25
继续找状态,慢慢恢复:点击打开链接
策略证明如下(声明:PPT为转载):
#include <iostream>#include <algorithm>#include <cstring>using namespace std;int tian[1001];int qi[1001];bool cmp(int a,int b){return a>b;}int main(){int horse;while(cin>>horse){int tianbest,tianworst,qibest,qiworst;int counter=0;if(horse==0)break;for(int i=0;i<horse;i++)cin>>tian[i];for(int j=0;j<horse;j++)cin>>qi[j];sort(tian,tian+horse,cmp);sort(qi,qi+horse,cmp);tianbest=0;qibest=0;tianworst=horse-1;qiworst=horse-1;int dui=0;while(dui++<horse){if(tian[tianbest]>qi[qibest]){counter+=200;tianbest++;qibest++;}else if(tian[tianbest]<qi[qibest]){counter-=200;tianworst--;qibest++;}else if(tian[tianbest]==qi[qibest]){if(tian[tianworst]>qi[qiworst]){counter+=200;tianworst--;qiworst--;} else { if(tian[tianworst]<qi[qibest]) { counter-=200; } tianworst--; qibest++; }}}cout<<counter<<endl;}return 0;}
0 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 1052 Tian Ji -- The Horse Racing
- hdu-1052Tian Ji -- The Horse Racing
- HDU - 1052 Tian Ji -- The Horse Racing
- C++ 基础
- vc6.0 如何添加全局变量
- USACO/costume/化装晚会 [Neal Wu, 2007]
- python win32编程
- Emacs 24.3 使用 w3m访问网页
- 【继续找状态做简单题】HDU 1052 Tian Ji -- The Horse Racing
- 线程处理函数pthread_cleanup_push / pthread_cleanup_pop
- RAM和ROM的区别
- 人生没有如果,命运不相信假设
- 凸优化讲义英文版
- 机房收费系统小结
- 寒假学习 第21天 (linux 高级编程)
- 社交应用在中国总是误入歧途的原因
- 终于在android下面完成了ffmpeg最新版的编译