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[],b[],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=,ta=n-,hb=,tb=n-,ans=;
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*<<endl;
}
return ;
}
#define 用起来
ZOJ Problem Set - 2397 Tian Ji -- The Horse Racing的更多相关文章
- ZOJ 2397:Tian Ji -- The Horse Racing
Tian Ji -- The Horse Racing Time Limit: 5 Seconds Memory Limit: 32768 KB Here is a famous story ...
- Hdu 1052 Tian Ji -- The Horse Racing
Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- Tian Ji -- The Horse Racing
Tian Ji -- The Horse Racing Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Jav ...
- UVA 1344 Tian Ji -- The Horse Racing
Tian Ji -- The Horse Racing Here is a famous story in Chinese history. That was about 2300 years ago ...
- hdoj 1052 Tian Ji -- The Horse Racing【田忌赛马】 【贪心】
思路:先按从小到大排序, 然后从最快的開始比(如果i, j 是最慢的一端, flag1, flag2是最快的一端 ),田的最快的大于king的 则比較,如果等于然后推断,有三种情况: 一:大于则比較, ...
- hdu1052 Tian Ji -- The Horse Racing 馋
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:pid=1052">http://acm.hdu.edu.cn/showproblem.php ...
- 杭州电 1052 Tian Ji -- The Horse Racing(贪婪)
http://acm.hdu.edu.cn/showproblem.php? pid=1052 Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS ...
- 【贪心】[hdu1052]Tian Ji -- The Horse Racing(田忌赛马)[c++]
Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- 【OpenJ_Bailian - 2287】Tian Ji -- The Horse Racing (贪心)
Tian Ji -- The Horse Racing 田忌赛马,还是English,要不是看题目,我都被原题整懵了,直接上Chinese吧 Descriptions: 田忌和齐王赛马,他们各有n匹马 ...
随机推荐
- C# Winform Soket 网络编程 多个客户端连接服务器并返回客户端操作请求
2017.8.2 服务器: #region 参数与集合 /// <summary> /// 客户端IP /// </summary> string clientIP; /// ...
- excel支持正则表达式提取字符函数(支持RegExp捕获分组)
一.要让excel脚本支持Microsoft VBScript Regular Expressions 5.5 ,按快捷键alt+F11,出现下图界面,操作如图示: 二.添加VBA代码: 代码添加完毕 ...
- consul搭建
1.准备3台服务器 linux1 192.168.0.101 linux2 192.168.0.102 linux3 192.168.0.103 2.准备向Linux上传文件的工具Winscp 3.去 ...
- NotePad++ 添加HEX-Editor插件
步骤: 一.下载插件 https://github.com/chcg/NPP_HexEdit/releases 二.选择插件版本 Notepad 官网客服提示:32bit Notepad++可以使用常 ...
- Github使用:使用github用作自己的免费域名
1.创建一个新仓库 --- 删除里面的文件 --- Git上传文件到新仓库(必须有index.html) 2. 点击新仓库的setting,下滑找到GitHub Pages ---- 点击第一行的链接 ...
- Ubuntu安装pyenv实现python多版本控制
Ubuntu安装pyenv实现python多版本控制 git clone git://github.com/yyuu/pyenv.git ~/.pyenv echo 'export PYENV_ROO ...
- 配置wildfly10为linux的服务,并开机启动
1.在opt路径下 下载 wildfly ,并解压下载下的压缩包 cd /opt sudo wget -c http://download.jboss.org/wildfly/10.0.0.Final ...
- kubernetes1.7.6 ha高可用部署
写在前面: 1. 该文章部署方式为二进制部署. 2. 版本信息 k8s 1.7.6,etcd 3.2.9 3. 高可用部分 etcd做高可用集群.kube-apiserver 为无状态服务使用hap ...
- Python是一门什么样的语言
先做个总结:Python是一门动态解释型的强类型定义语言. 那何为动态?何为解释?何为强类型呢? 我们需要了解编译型和解释型.静态语言和动态语言.强类型定义语言和弱类型定义语言这6个概念就可知晓. 编 ...
- 洛谷P1064--金明的预算方案(简单背包)
https://www.luogu.org/problemnew/show/P1064 #include<iostream> #include<algorithm> #incl ...