ZOJ Problem Set - 2397 Tian Ji -- The Horse Racing
2014-04-09 19:38
288 查看
#include<iostream> #include<cmath> #include<algorithm> #define REP(i,n) for(int i=0;i<(n);i++) using namespace std; int a[2000],b[2000],n; int main(){ while (cin>>n,n){ REP(i,n)cin>>a[i]; REP(i,n)cin>>b[i]; sort(a,a+n); sort(b,b+n); int ha=0,ta=n-1,hb=0,tb=n-1,ans=0; REP(i,n){ if (a[ha]>b[hb])ans++,ha++,hb++; else if (a[ta]>b[tb])ans++,ta--,tb--; else ans-=(a[ha]!=b[tb]),ha++,tb--; } cout<<ans*200<<endl; } return 0; }
#define 用起来
相关文章推荐
- ZOJ 2397(HDU 1052) Tian Ji -- The Horse Racing 贪心
- ZOJ 2397:Tian Ji -- The Horse Racing
- ZOJ:2397 Tian Ji -- The Horse Racing
- hdu 1052&ZOJ 2397 Tian Ji -- The Horse Racing
- General Problem Solving Techniques [Intermediate-1]~F - Tian Ji -- The Horse Racing
- ZOJ Problem Set – 2321 Filling Out the Team
- Tian Ji -- The Horse Racing
- HDU1052 Tian Ji -- The Horse Racing 田忌赛马 贪心
- Tian Ji -- The Horse Racing **
- LA 3266 Tian Ji -- The Horse Racing 田忌赛马 【贪心】
- ZOJ Problem Set–1350 The Drunk Jailer
- poj 2287 Tian Ji -- The Horse Racing(贪心)
- HDU1052 Tian Ji -- The Horse Racing
- ZOJ Problem Set - 1056 The Worm Turns
- HDU-Tian Ji -- The Horse Racing
- hdu_1.3.1_FatMouse' Trade,hdu_1.3.2_Tian Ji -- The Horse Racing
- LA 3266 Tian Ji -- The Horse Racing
- POJ2287/UVA1344 Tian Ji -- The Horse Racing
- ZOJ Problem Set - 1350 The Drunk Jailer ac代码 memset
- hdu1052 Tian Ji -- The Horse Racing 馋