其他分享
首页 > 其他分享> > hdu 1052 田忌赛马

hdu 1052 田忌赛马

作者:互联网

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1052

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int w[1010],t[1010],i,j,s,n;
	while(scanf("%d",&n)!=EOF)
	{
		if(n==0) break;
		i=j=s=0;
		for(i=0;i<n;i++)
		scanf("%d ",t+i);
		for(i=0;i<n;i++)
		scanf("%d ",w+i);
		sort(t,t+n-1,greater<int>());
		sort(w,w+n-1,greater<int>());
		for(i=0;i<n;i++)
		{
			if(w[i]>t[j])
			{
				s--;
				j--;
			}
			else if(w[i]==t[j])
			{
				
			}
			else
			{
				s++;
			}
			j++;
		}
		printf("%d\n",s*200);
	}
	return 0;
}

标签:hdu,田忌赛马,int,1052,else,--,1010
来源: https://blog.csdn.net/qq_52029941/article/details/115675553