题目传送门

 /*
水题:找排序找中间的价格,若有两个,选价格大的;
写的是有点搓:)
*/
#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. WinAPI【远程注入】三种注入方案【转】

    来源:http://www.cnblogs.com/okwary/archive/2008/12/20/1358788.html 导言: 我 们在Code project(www.codeprojec ...

  2. Android四大组件之Service

    Android四大组件之Service Android支持服务的概念,服务是在后台运行的组件,没有用户界面,Android服务可用有与活动独立的生命周期.Android支持两种类型的服务: 本地服务: ...

  3. 对大一新生开始学习C语言课程谈几点看法

    大家好,首先祝贺大家进入了大学,迈入了大学的校门,也意味着开始了新的征程,希望大家能够有一个美好的大学四年. 先做下自我介绍,我叫李帅阳,(大家可以称呼我 李老师,或是班助,或是...)这是在邹欣老师 ...

  4. hiho一下 第九十四周 数论三·约瑟夫问题

    数论三·约瑟夫问题 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho的班级正在进行班长的选举,他们决定通过一种特殊的方式来选择班长. 首先N个候选人围成一个 ...

  5. nginx(三)初步搭建nginx虚拟主机

    上面就是nginx基于域名.ip访问的配置,掌握住格式,就很好配置了. 一.基于域名的虚拟主机的配置:1.我们在此复习一下DNS的配置:[root@mgmserver /]# hostnamemgms ...

  6. PHP快速抓取快递信息

    <?php header("Content-type:text/html;charset=utf-8"); /** * Express.class.php 快递查询类 * @ ...

  7. ubuntu 12.04 server编译安装nginx

    tar -xvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./config make make install above is for zlib(refers http:// ...

  8. RAID阵列的初始化与管理

    如果我们创建RAID阵列的目的是新部署一台服务器,我们建议所有新创建的RAID阵列都应该做初始化操作,这样,硬盘上原有的用户数据将被清除,以便进行后续的系统,软件安装. 转自: http://zh.c ...

  9. Linux系统Shutdown命令定时关机详解

    转自:http://www.bootf.com/490.html Linux系统下的shutdown命令用于安全的关闭/重启计算机,它不仅可以方便的实现定时关机,还可以由用户决定关机时的相关参数.在执 ...

  10. codeforces B. Vasya and Public Transport 解题报告

    题目链接:http://codeforces.com/problemset/problem/355/B 题目意思:给出四种票种,c1: 某一部bus或者trolley的单程票(暗含只可以乘坐一次):c ...