http://poj.org/problem?id=3664

进行两轮选举,第一轮选前n进入第二轮,第二轮选最高

#include<algorithm>
#include<cstdio>
using namespace std;
struct vote
{
int a,b;
int c;
};
bool cmp1(const vote & a ,const vote & b)
{
return a.a>b.a;
} bool cmp( const vote& a ,const vote& b)
{
return a.b>b.b;
}
int main()
{
int n,k;
scanf("%d%d",&n,&k);
vote aa[];
for(int i=;i<n;i++)
{
aa[i].c=;
scanf("%d%d",&aa[i].a,&aa[i].b);
aa[i].c=i+;
}
sort(aa,aa+n,cmp1);
sort(aa,aa+k,cmp); printf("%d\n",aa[].c);
return ;
}

poj 3664的更多相关文章

  1. POJ 3664 Election Time 题解

    这道题网上非常多人都会说easy,水题之类的话,只是我看了下说这种话的人的程序,能够说他们的程序都不及格! 为什么呢?由于他们的程序都是使用简单的二次排序水过(大概你能搜索到的多是这种程序).那样自然 ...

  2. 网络-05-端口号-F5-负载均衡设-linux端口详解大全--TCP注册端口号大全备

    [root@test1:Standby] config # [root@test1:Standby] config # [root@test1:Standby] config # [root@test ...

  3. 【poj解题】3664

    简单,两次排序 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 500 ...

  4. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  5. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  6. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  7. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  8. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  9. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

随机推荐

  1. VS2005 添加onTimer定时器

    SetTimer(1,300,NULL); void CchangeDisplayDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调 ...

  2. 嵌入式linux------ffmpeg移植 解码H264(am335x解码H264到yuv420并通过SDL显示)

    /* 编译命令:arm-linux-gcc -o show2642 264showyuv2.c -I/usr/local/ffmpeg_arm/include/ -L/usr/local/ffmpeg ...

  3. Unhandled event loop exception Java heap space

    1 错误描述 2 错误原因 3 解决办法

  4. directX显示采集源(摄像头)filter

    IGraphBuilder * g_pGraphBuilder = NULL;IBaseFilter *Pbf=0;IVideoWindow  * g_pVWindow = NULL;IMediaCo ...

  5. CF370 D Memory and Scores

    dp题 并运用了前缀和 我看题目提示中有fft 我想了下感觉复杂度不过关还是未解 #include<bits/stdc++.h> using namespace std; typedef ...

  6. monkey日志分析

    Monkey测试的og分析,我们可以通过几个关键词来判断测试是否通过.1)Monkey finished打开LOG,查看log的最下端,是否有类似以下字段:## Network stats: elap ...

  7. java 值传递和引用传递

    public class PassValue { /** * 值传递 基本数据类型参数 * 值传递:方法调用时,实际参数吧他的值传递给对应的形式参数,方法执行中形式参数值的改变不影响实际参数的值 */ ...

  8. Emacs考场配置

    当年\(NOip\)考场配置不记得啦 存在这里搞事情 (set-background-color "gray15") (set-foreground-color "gra ...

  9. python3下Django2.0配置最新xadmin详解

    1,打开pycharm,创建一个Django项目 2,安装Django,默认是最新版本,pip3 install -i https://pypi.douban.com/simple/ django 3 ...

  10. SpringMVC常用注解整理

    一.组件型注解: @Component 在类定义之前添加@Component注解,他会被spring容器识别,并转为bean. @Repository 对Dao实现类进行注解 (特殊的@Compone ...