题目传送门

 /*
水题:找排序找中间的价格,若有两个,选价格大的;
写的是有点搓:)
*/
#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的更多相关文章

  1. 水题 ZOJ 3876 May Day Holiday

    题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...

  2. 水题 ZOJ 3880 Demacia of the Ancients

    题目传送门 /* 水题:) */ #include <cstdio> #include <iostream> #include <algorithm> #inclu ...

  3. 水题 ZOJ 3869 Ace of Aces

    题目传送门 水题,找出出现次数最多的数字,若多个输出Nobody //#include <bits/stdc++.h> //using namespace std; #include &l ...

  4. [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]

    The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...

  5. [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 ...

  6. [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]

    MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...

  7. 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 ...

  8. ZOJ 17届校赛 Knuth-Morris-Pratt Algorithm( 水题)

    In computer science, the Knuth-Morris-Pratt string searching algorithm (or KMP algorithm) searches f ...

  9. ZOJ 3778 C - Talented Chef 水题

    LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778 题意:有n道菜,每道菜需要\(a_i\)道工序,有m个锅可 ...

随机推荐

  1. 在C#中开启事务

    1.为什么要开启事务: 举一个简单的例子:在银行业务中,有一条记账原则,即又借有贷.为了保证这种原则,每发生一笔银行业务,就必须保证会计账目上借方科目和贷方科目至少个少一笔,并且这两笔要么同时成功,要 ...

  2. HDU 2204 Eddy's爱好(容斥原理)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2204 解题报告:输入一个n让你求出[1,n]范围内有多少个数可以表示成形如m^k的样子. 不详细说了, ...

  3. [Effective JavaScript 笔记]第52条:数组字面量优于数组构造函数

    js的优雅很大程序要归功于程序中常见的构造块(Object,Function及Array)的简明的字面量语法.字面量是一种表示数组的优雅方法. var a=[1,2,3,5,7,8]; 也可以使用构造 ...

  4. PHP 基础语法实例及注意事项

    <?$varint = 1;$varinteger = "test";$varstring = "tes";$varbool = true;$varflo ...

  5. HDOJ 2095

    find your present (2) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/1024 K (Java/Oth ...

  6. LocalResizeIMG前端HTML5本地压缩图片上传,兼容移动设备IOS,android

    LocalResizeIMG前端HTML5本地压缩图片上传,兼容移动设备IOS,android jincon 发表于 2015-02-26 18:31:01 发表在: php开发 localresiz ...

  7. 【SpringMVC】SpringMVC系列15之SpringMVC最佳实践

    15.SpringMVC最佳实践 15.1.遵循Restful API最佳实践 参考:http://segmentfault.com/a/1190000002949234 15.2.统一返回字段 15 ...

  8. echart所有汉字都显示中文,就echarts的toolbox注释显示乱码

    echarts无所谓支不支持gbk编码这么一说,关键是页面的charset和echarts.js文件的charset是否匹配,如果不匹配,请使用如下方式引入: <script src=" ...

  9. ali2015校园招聘笔试大题

    [本文链接] http://www.cnblogs.com/hellogiser/p/ali-2015-questions.html 1. 写一个函数,输入一个二叉树,树中每个节点存放了一个整数值,函 ...

  10. 【转】tomcat下部署 solr 5.3.1

    本文转自:http://blog.csdn.net/lianghyan/article/details/49467207 solr下载: http://lucene.apache.org/solr/d ...