[河南省ACM省赛-第三届] AMAZING AUCTION (nyoj 251)
题目链接: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)的更多相关文章
- [河南省ACM省赛-第三届] 素数 (nyoj 169)
#include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...
- [河南省ACM省赛-第三届] 房间安排 (nyoj 168)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...
- [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...
- [河南省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 ...
- [河南省ACM省赛-第三届] BUYING FEED (nyoj 248)
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...
- [河南省ACM省赛-第四届] 序号互换 (nyoj 303)
相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<strin ...
- [河南省ACM省赛-第四届] 表达式求值(nyoj 305)
栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string&g ...
- Mine Number(搜索,暴力) ACM省赛第三届 G
Mine Number Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Every one once played the gam ...
- [原]sdut2624 Contest Print Server (大水+大坑)山东省第四届ACM省赛
本文出自:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&am ...
随机推荐
- 记录最近在使用sprintf构造字符串时遇到的一个问题
直接上代码: #include "stdio.h" #include "string.h" int main() { char szTmp[20] = {0}; ...
- journaling保证意外故障下的数据完整性
mongoDB研究笔记:journaling保证意外故障下的数据完整性 mongoDB的Journaling日志功能与常见的log日志是不一样的,mongoDB也有log日志,它只是简单记录了数据 ...
- IOS touch event animation 转动的风车
最近开始学习IOS的开发,师兄给我提出一个需求:实现一个可拖动的转盘.师兄提示我说利用touch event和UIView animation.经过一两天的折腾边学边做,算是实现了基本功能.这里写写加 ...
- 关于Update语句的锁
关于Update语句的锁 环境:MSSQL2005,在Read Committed级别 语句A:begin tranUpdate Table Set f1='xxx' where f2='ttt' ...
- img onerror事件
怪自己知道的太少,img标签有onerror这个事件,我是才刚知道,恕我愚昧,既然是第一次遇到,而且又是一个自己从没有涉及过得的东西,所以我希望通过这个随笔来是自己印象深刻,此文仅仅只是让自己印象深刻 ...
- python schedule processor
run some tasks which could look like CRON within linux/UNIX in python. Here's a demo which run on ub ...
- linux php 安装GD库
linux下为php添加GD库的步骤如下: 一.下载 gd-2.0.33.tar.gz http://www.boutell.com/gd/ jpegsrc.v6b.tar.gz http://www ...
- struts2中token的令牌机制
通常在普通的操作当中,我们不需要处理重复提交的,而且有很多方法来防止重复提交.比如在登陆过程中,通过使用redirect,可以让用户登陆之上重定向到后台首页界面,当用户刷新界面时就不会触发重复提交了. ...
- Static 单例模式
Static 方法的问题 今天在看EhCache源码的时候,发现有一个这样的方法 这个是个典型的单例模式的工具类,但我所知道的单例模式的写法不是这样的,虽然<effect java>中 ...
- GestureDetector学习之左右滑动,上下滑动屏幕切换页面
要实现滑屏等触发事件,视情况而定: 如果实现的触屏或者手势效果较多,则使用第一种方法,实现OnGestureListener 接口(参考OnGestureListener): 如果只是实现较少的效果, ...