码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 3664

时间:2015-02-23 11:57:39      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

水水更健康

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const int N=50100;

struct COW{
	int f,s,d;
}cows[N];

bool cmp1(COW a,COW b){
	if(a.f>b.f) return true;
	return false;
}

bool cmp2(COW a,COW b){
	if(a.s>b.s) return true;
	return false;
}

int n,k;

int main(){
	while(scanf("%d%d",&n,&k)!=EOF){
		for(int i=0;i<n;i++){
			scanf("%d%d",&cows[i].f,&cows[i].s);
			cows[i].d=i+1;
		}
		sort(cows,cows+n,cmp1);
		sort(cows,cows+k,cmp2);
		printf("%d\n",cows[0].d);
	}
	return 0;
}

  

POJ 3664

标签:

原文地址:http://www.cnblogs.com/jie-dcai/p/4297921.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!