水题 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个锅可 ...
随机推荐
- 神秘代码让iPhone微信闪退的解决方法
14号晚,很多人的微信朋友圈中出现了这样几句话“听说苹果手机点全文就会闪退”,下方有好几行空白,需要点击“全文”才能看到,但是一旦你是在iPhone手机微信上点击“原文”后就直接闪退了,而用Andro ...
- Q1微信用户增长11% 微信生态圈逐渐完善
就在今天早些时候,腾讯公布了Q1财报,微信和手Q游戏收入达18亿元,微信用户环比增长11%,微信生态圈逐渐完善.和xmyanke一起来看看具体的财报数字分析. 微信和手Q游戏付费用户环比增长100%以 ...
- 分页控件-ASP.NET(AspNetPager)
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: <div class="oa-el ...
- PHP 基础语法实例及注意事项
<?$varint = 1;$varinteger = "test";$varstring = "tes";$varbool = true;$varflo ...
- 关于LINUX文件与目录的问题说明
文件权限一般可认为是0 123 456 789,一共十位: 0:表示该文件的文件类型.Windows里面是使用了一种文件关联的技术,通过扩展名来关联相应的应用程序,使得双击某个文件,就能达到调用相应的 ...
- html 构建响应式网站之viewport的使用
在网页代码的头部,加入一行viewport元标签 <!DOCTYPE html> <html lang="en"> <head> <met ...
- HDOJ 1102 生成树
Constructing Roads Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- Maximum Product of Word Lengths
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the tw ...
- 使用Webdriver执行JS小结
首先,我们使用如下方式初始化driver: WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse = (JavascriptEx ...
- Solr DIH导入出现 Data Config problem: 前言中不允许有内容 异常
Solr配置DIH导入时出现 “Data Config problem: 前言中不允许有内容.” 异常. <response> <lst name="responseHea ...