题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251

规则:

1、若某竞标价唯一,则胜出

2、若不存在唯一竞标价,则投标次数最少竞标价中标,存在多个时,选择价钱最低且最先投此价钱的为中标

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 102
#define M 1002

struct Node{
    ];
    int p;
}c[N];
int cntp[M];

int main()
{
    //freopen("d:\\in.txt", "r", stdin);
    int s, n;
    while(cin>>s>>n){
        memset(cntp, , sizeof(cntp));
        ; i<n; i++){
            cin>>c[i].name>>c[i].p;
            cntp[c[i].p]++;
        }
        int minp = M, k;
        ; i<= ; i++){
            if(cntp[i] && cntp[i]<minp){
                minp = cntp[i];
                k = i;
            }
        }
        int i;
        ; i<N; i++){
            if(c[i].p == k)
                break;
        }
        printf("The winner is %s\nThe price is %d\n", c[i].name, c[i].p);
    }
    ;
}

[河南省ACM省赛-第三届] AMAZING AUCTION (nyoj 251)的更多相关文章

  1. [河南省ACM省赛-第三届] 素数 (nyoj 169)

    #include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...

  2. [河南省ACM省赛-第三届] 房间安排 (nyoj 168)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...

  3. [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...

  4. [河南省ACM省赛-第三届] 聪明的kk (nyoj 171)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171 动态规划: d(i,j) = max{d(i-1, j), d(i, j-1)}+m ...

  5. [河南省ACM省赛-第三届] BUYING FEED (nyoj 248)

    #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...

  6. [河南省ACM省赛-第四届] 序号互换 (nyoj 303)

    相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<strin ...

  7. [河南省ACM省赛-第四届] 表达式求值(nyoj 305)

    栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string&g ...

  8. Mine Number(搜索,暴力) ACM省赛第三届 G

    Mine Number Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Every one once played the gam ...

  9. [原]sdut2624 Contest Print Server (大水+大坑)山东省第四届ACM省赛

    本文出自:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&am ...

随机推荐

  1. struts2图片显示

    struts2图片显示即是文件下载 一.配置struts.xml struts.xml中配置stream结果类型,并配置contentType.inputName.contentDisposition ...

  2. Redis系统学习 一、基础知识

    1.数据库 select 1  select 0 2.命令.关键字和值 redis不仅仅是一种简单的关键字-值型存储,从其核心概念来看,Redsi的5种数据结构中的每一个都至少有一个关键字和一个值.在 ...

  3. python文件的中文处理以及个人思路

    环境:ubuntu12.04 python2.7  涉及:ascii,utf-8,gbk,gb2312 首先说下个人处理过程中遇到的问题: 任务是这样:有大概4000个txt,将他们合并到一个文件里, ...

  4. AOP之拦截函数调用链实现

    AOP之拦截函数调用链实现 定义函数A,B,C,调用A->B->C,这样就形成了函数静态调用链,而AOP要做的是能动态的添加多个B,形成A->B1->B2->B3...- ...

  5. etcd使用之ttl不准确问题

    问题现象 部署有一个etcd集群,分别是10.8.65.106,10.8.65.107和10.8.65.108. 然后我使用etcdctl为一个值设置ttl,然后通过watch观察,发现失效时间不准确 ...

  6. js操作

    1.1.直接传入Javascript代码,定位元素 js可以点击页面上不显示暂时隐藏(比如下拉列表),但是html文件中存在的属性 WebDriver driver = new FirefoxDriv ...

  7. 使用highcharts显示mongodb中的数据

    1.mongodb数据表相关 # 显示数据库 show dbs # 数据库 use ceshi # 显示表 show tables # 创建集合 db.createCollection('infoB' ...

  8. [Angular Directive] Implement Structural Directive Data Binding with Context in Angular

    Just like in *ngFor, you're able to pass in data into your own structural directives. This is done b ...

  9. Elasticsearch 5.0 磁盘空间节省策略的认识

    前言:本文是当时QQ群员讨论磁盘空间如何优化,我搜了下类似的文章,结合官方文档做了一些总结 参考文章1 参考文章2 如果你有疑问,可以联系我参与讨论,或者去原文查看. NOTE: 磁盘空间节省问题,是 ...

  10. docker安装使用

    介绍 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不会 ...