题目链接: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. SQL 语句中的union操作符

    前端时间,用到了union操作符,周末有时间总结下,w3c手册内容如下: SQL UNION操作符 UNION操作符用于合并两个或多个select语句的结果集. 注意:UNION内部select语句必 ...

  2. VS2003与Win7的兼容性问题

    VS2003并不官方支持Win7,目前大家遇到的主要是两个问题: 1. 在debug的时候,*.pdb文件在会被devenv.exe给lock住,当调适过一次之后,再进行编译的时候会有lnk1201的 ...

  3. NPinyin 中文转换拼音代码

    Mono 3.2 测试NPinyin 中文转换拼音代码   C#中文转换为拼音NPinyin代码  在Mono 3.2下运行正常,Spacebuilder 有使用到NPinyin组件,代码兼容性没有问 ...

  4. 实现Avl平衡树

    实现Avl平衡树   一.介绍 AVL树是一种自平衡的二叉搜索树,它由Adelson-Velskii和 Landis于1962年发表在论文<An algorithm for the organi ...

  5. linux 原生系统发送电子邮件 (在本地与因特网)

    有用的资料在 Linux mail 命令 http://www.cnblogs.com/JemBai/archive/2012/01/24/2329136.html 还有这里 Linux系统下mail ...

  6. mybatis 入门进阶之 pojo

    有时候我们dao方法声明的入参需要是自定义的pojo,以满足复杂的查询条件. IWebUserCustomDao.java package com.mozi.dao; import java.util ...

  7. 程序集和反射(C#)

    这里我又唠叨几句,大家在学习的时候,如看书或者看视频时觉得非常爽,因为感觉基本都看得懂也都挺容易的,其实看懂是一回事,你自己会动手做出来是一回事,自己能够说出来又是另一回事了.应该把学到的东西变成自己 ...

  8. restful Api 风格契约设计器:Swagger-editor和swagger-ui的应用

    swagger-editor的安装 swagger-editor应用的yaml语法,有定义变量和数据结构,不明白可以参考其示例 安装步骤: 下载swagger-editor git地址 运行npm r ...

  9. js判断移动端与pc端

    这里介绍下使用device.js插件来判断移动端设备 地址:https://github.com/matthewhudson/device.js 示例: if(device.mobile()){ wi ...

  10. OpenH264

    转自:http://blog.csdn.net/chinabinlang/article/details/41209053 目前最常用的264工程师x264: 最近有又有一个开源工程OpenH264, ...