水题 ZOJ 3875 Lunch Time
/*
水题:找排序找中间的价格,若有两个,选价格大的;
写的是有点搓:)
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f;
struct S
{
char name[];
int p;
}s[];
struct M
{
char name[];
int p;
}m[];
struct D
{
char name[];
int p;
}d[]; bool cmp_s(S x, S y)
{
return x.p < y.p;
} bool cmp_m(M x, M y)
{
return x.p < y.p;
} bool cmp_d(D x, D y)
{
return x.p < y.p;
} int main(void) //ZOJ 3875 Lunch Time
{
//freopen ("G.in", "r", stdin); int t;
scanf ("%d", &t);
while (t--)
{
int a, b, c;
int tot = , s_id, m_id, d_id; scanf ("%d%d%d", &a, &b, &c);
for (int i=; i<=a; ++i)
{
scanf ("%s%d", &s[i].name, &s[i].p);
}
sort (s+, s++a, cmp_s);
for (int i=; i<=b; ++i)
{
scanf ("%s%d", &m[i].name, &m[i].p);
}
sort (m+, m++b, cmp_m);
for (int i=; i<=c; ++i)
{
scanf ("%s%d", &d[i].name, &d[i].p);
}
sort (d+, d++c, cmp_d); if (a & )
{
tot += s[(a+)/].p; s_id = (a+) / ;
}
else
{
int l = a / ; int r = l + ;
if (s[l].p < s[r].p)
{
tot += s[r].p; s_id = r;
}
else
{
tot += s[l].p; s_id = l;
}
}
if (b & )
{
tot += m[(b+)/].p; m_id = (b+) / ;
}
else
{
int l = b / ; int r = l + ;
if (m[l].p < m[r].p)
{
tot += m[r].p; m_id = r;
}
else
{
tot += m[l].p; m_id = l;
}
}
if (c & )
{
tot += d[(c+)/].p; d_id = (c+) / ;
}
else
{
int l = c / ; int r = l + ;
if (d[l].p < d[r].p)
{
tot += d[r].p; d_id = r;
}
else
{
tot += d[l].p; d_id = l;
}
} printf ("%d %s %s %s\n", tot, s[s_id].name, m[m_id].name, d[d_id].name);
} return ;
} /*
15 Fresh_Cucumber Fried_Vermicelli Steamed_Stuffed_Bun
108 West_Lake_Water_Shield_Soup DongPo's_Braised_Pork DongPo's_Crisp
*/
水题 ZOJ 3875 Lunch Time的更多相关文章
- 水题 ZOJ 3876 May Day Holiday
题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...
- 水题 ZOJ 3880 Demacia of the Ancients
题目传送门 /* 水题:) */ #include <cstdio> #include <iostream> #include <algorithm> #inclu ...
- 水题 ZOJ 3869 Ace of Aces
题目传送门 水题,找出出现次数最多的数字,若多个输出Nobody //#include <bits/stdc++.h> //using namespace std; #include &l ...
- [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]
The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...
- [ACM_水题] ZOJ 3714 [Java Beans 环中连续m个数最大值]
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand ...
- [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...
- ZOJ 2679 Old Bill ||ZOJ 2952 Find All M^N Please 两题水题
2679:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1679 2952:http://acm.zju.edu.cn/onli ...
- ZOJ 17届校赛 Knuth-Morris-Pratt Algorithm( 水题)
In computer science, the Knuth-Morris-Pratt string searching algorithm (or KMP algorithm) searches f ...
- ZOJ 3778 C - Talented Chef 水题
LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778 题意:有n道菜,每道菜需要\(a_i\)道工序,有m个锅可 ...
随机推荐
- 使用css3来实现边框圆角效果
经常看到别人的网站有个边框来修饰文字区域,类似圆角矩形把文字环绕起来,特别有感觉,于是就试着用图片边框来修饰,但是用图片过多会拉慢网页的加载速度,能不能使用css3来实现边框圆角效果呢?当然borde ...
- 北工大耿丹学院16级计科院3班C语言课程助教学期总结
很荣幸得到邹老师,周老师,以及北工大耿丹学院各位老师的认可,担任计科院3班C语言课程助教,班主任为李光杰老师,很感谢李老师一学期的帮助,使得我更好的担任助教一职.我班学生31名,很愉快的与同学们度过一 ...
- Python os.system 和 os.popen的区别
(1) os.system # 仅仅在一个子终端运行系统命令,而不能获取命令执行后的返回信息 system(command) -> exit_statusExecute the command ...
- Tornaod框架
Tornado 是 FriendFeed 使用的可扩展的非阻塞式 web 服务器及其相关工具的开源版本.这个 Web 框架看起来有些像web.py 或者 Google 的 webapp,不过为了能有效 ...
- MySQL Profiling 的使用
MySQL Profiling 的使用 在本章第一节中我们还提到过通过 Query Profiler 来定位一条 Query 的性能瓶颈,这里我们再详细介绍一下 Profiling 的用途及使用方法. ...
- jekyll中文乱码问题
一般编写都是采用utf-8的吧,但是在windows下安装的jekyll,默认是以GBK编码的方式去读取咱们编写的文件,如此便乱码了. 要解决此问题,总不至于要写GBK编码的文件吧,毕竟这个编码不怎么 ...
- 17.把字符串转换成整数[atoi]
[题目] 把字符串转换成整数,需要考虑字符串有效性. [代码] C++ Code 123456789101112131415161718192021222324252627282930313233 ...
- mysql update case when和where之间的注意事项
在日常开发中由于业务逻辑较为复杂,常常需要用到UPDATE和CASE...WHEN...THEN...ELSE...END一起做一些复杂的更新.有时候因为对这几个字句理解得不透彻会带来很大的困扰.因此 ...
- MPlayer-ww 增加边看边剪切功能
解压到 D:\MPlayer-ww 运行 copy_font.bat 安装字体 LED_font.ttf 双击 MPlayer_ww_openWith.reg 添加右键播放功能 outformat.i ...
- mysql如何利用Navicat 导出和导入数据库
MySql是我们经常用到的数据,无论是开发人员用来练习,还是小型私服游戏服务器,或者是个人软件使用,都十分方便.对于做一些个人辅助软件, 选择mysql数据库是个明智的选择,有一个好的工具更是事半功倍 ...