ZOJ Problem Set - 2397 Tian Ji -- The Horse Racing

简介:

#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 - Problem Set - 3960 What Kind of Friends Are You?
ZOJ - Problem Set - 3960 What Kind of Friends Are You?
82 0
ZOJ - Problem Set - 3960 What Kind of Friends Are You?
ZOJ - Problem Set - 3985 String of CCPC
ZOJ - Problem Set - 3985 String of CCPC
92 0
ZOJ Problem Set - 3758 素数
ZOJ Problem Set - 3758 素数
97 0
ZOJ Problem Set - 3758 素数
Singles’ Day Time Limit: 2 Seconds Memory Limit: 65536 KB Singles’ Day(or One’s Day), an unofficial holiday in China, is a pop cu...
922 0
|
存储 算法 索引
ZOJ 3505. Yet Another Set of Numbers 解题报告
    ZOJ 3505:Yet Another Set of Numbers     地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3505       题意:有一个数字集合,集合中的数遵循以下规则:       ( 1 ).
918 0