题目传送门

 /*
构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:(
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <iostream>
#include <string>
using namespace std; const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f;
struct Phone
{
string name;
string num[MAXN];
int tot, t, p, g, id;
}p[MAXN]; bool cmp_t(Phone x, Phone y)
{
if (x.t == y.t) return x.id < y.id;
return x.t > y.t;
} bool cmp_p(Phone x, Phone y)
{
if (x.p == y.p) return x.id < y.id;
return x.p > y.p;
} bool cmp_g(Phone x, Phone y)
{
if (x.g == y.g) return x.id < y.id;
return x.g > y.g;
} int main(void) //Codeforces Round #107 (Div. 2) B. Phone Numbers
{
// freopen ("C.in", "r", stdin); int n;
while (cin >> n)
{
for (int i=; i<=n; ++i)
{
cin >> p[i].tot >> p[i].name; p[i].id = i;
p[i].t = p[i].p = p[i].g = ;
for (int j=; j<=p[i].tot; ++j)
{
cin >> p[i].num[j];
if (p[i].num[j][] == p[i].num[j][] && p[i].num[j][] == p[i].num[j][] &&
p[i].num[j][] == p[i].num[j][] && p[i].num[j][] == p[i].num[j][] &&
p[i].num[j][] == p[i].num[j][]) p[i].t++;
else if (p[i].num[j][] > p[i].num[j][] && p[i].num[j][] > p[i].num[j][] &&
p[i].num[j][] > p[i].num[j][] && p[i].num[j][] > p[i].num[j][] &&
p[i].num[j][] > p[i].num[j][]) p[i].p++;
}
p[i].g = p[i].tot - p[i].t - p[i].p;
// cout << p[i].t << " " << p[i].p << " " << p[i].g << endl;
} int pre = ;
sort (p+, p++n, cmp_t);
cout << "If you want to call a taxi, you should call: ";
for (int i=; i<=n; ++i)
{
if (i == )
{
cout << p[i].name; pre = p[i].t;
}
else if (p[i].t == pre) cout << ", " << p[i].name;
else break;
}
cout << "." << endl;
sort (p+, p++n, cmp_p);
cout << "If you want to order a pizza, you should call: ";
for (int i=; i<=n; ++i)
{
if (i == )
{
cout << p[i].name; pre = p[i].p;
}
else if (p[i].p == pre) cout << ", " << p[i].name;
else break;
}
cout << "." << endl;
sort (p+, p++n, cmp_g);
cout << "If you want to go to a cafe with a wonderful girl, you should call: ";
for (int i=; i<=n; ++i)
{
if (i == )
{
cout << p[i].name; pre = p[i].g;
}
else if (p[i].g == pre) cout << ", " << p[i].name;
else break;
}
cout << "." << endl;
} return ;
} /*
If you want to call a taxi, you should call: Rogulenko.
If you want to order a pizza, you should call: Fedorov, Rogulenko, Kaluzhin.
If you want to go to a cafe with a wonderful girl, you should call: Melnikov.
*/

构造 Codeforces Round #107 (Div. 2) B. Phone Numbers的更多相关文章

  1. 构造 Codeforces Round #302 (Div. 2) B Sea and Islands

    题目传送门 /* 题意:在n^n的海洋里是否有k块陆地 构造算法:按奇偶性来判断,k小于等于所有点数的一半,交叉输出L/S 输出完k个L后,之后全部输出S:) 5 10 的例子可以是这样的: LSLS ...

  2. 构造 Codeforces Round #310 (Div. 2) B. Case of Fake Numbers

    题目传送门 /* 题意:n个数字转盘,刚开始每个转盘指向一个数字(0~n-1,逆时针排序),然后每一次转动,奇数的+1,偶数的-1,问多少次使第i个数字转盘指向i-1 构造:先求出使第1个指向0要多少 ...

  3. 构造 Codeforces Round #Pi (Div. 2) B. Berland National Library

    题目传送门 /* 题意:给出一系列读者出行的记录,+表示一个读者进入,-表示一个读者离开,可能之前已经有读者在图书馆 构造:now记录当前图书馆人数,sz记录最小的容量,in数组标记进去的读者,分情况 ...

  4. 暴力+构造 Codeforces Round #283 (Div. 2) C. Removing Columns

    题目传送门 /* 题意:删除若干行,使得n行字符串成递增排序 暴力+构造:从前往后枚举列,当之前的顺序已经正确时,之后就不用考虑了,这样删列最小 */ /*********************** ...

  5. 贪心+构造 Codeforces Round #277 (Div. 2) C. Palindrome Transformation

    题目传送门 /* 贪心+构造:因为是对称的,可以全都左一半考虑,过程很简单,但是能想到就很难了 */ /************************************************ ...

  6. 构造 Codeforces Round #275 (Div. 2) C. Diverse Permutation

    题目传送门 /* 构造:首先先选好k个不同的值,从1到k,按要求把数字放好,其余的随便放.因为是绝对差值,从n开始一下一上, 这样保证不会超出边界并且以防其余的数相邻绝对值差>k */ /*** ...

  7. 构造 Codeforces Round #135 (Div. 2) B. Special Offer! Super Price 999 Bourles!

    题目传送门 /* 构造:从大到小构造,每一次都把最后不是9的变为9,p - p MOD 10^k - 1,直到小于最小值. 另外,最多len-1次循环 */ #include <cstdio&g ...

  8. Codeforces Round #107 (Div. 1) B. Quantity of Strings(推算)

    http://codeforces.com/problemset/problem/150/B 题意: 给出n,m,k,n表示字符串的长度为n,m表示字符种类个数,k表示每k个数都必须是回文串,求满足要 ...

  9. 构造 - Codeforces Round #319 (Div. 1)C. Points on Plane

    Points on Plane Problem's Link Mean: 在二维坐标中给定n个点,求一条哈密顿通路. analyse: 一开始忽略了“无需保证路径最短”这个条件,一直在套最短哈密顿通路 ...

随机推荐

  1. [K/3Cloud] 创建一个业务单据表单插件

    概念 创建一个业务单据插件,处理单据的相关控制逻辑. 示例 新建一个类,继承自单据插件基类Kingdee.BOS.Core.Bill.PlugIn.AbstractBillPlugIn. using ...

  2. android开发里跳过的坑——图片文件上传失败

    使用的apache的httpclient的jar包,做的http图片上传,上传时,服务器总返文件格式不对.后来发现,是由于在创建FileBody时,使用了默认的ContentType引起的.所以服务器 ...

  3. Linux下汇编语言学习笔记66 ---

    这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...

  4. 中国福利彩票,牛B,开奖和数据传输有什么关系?

    昨天,由中国教育电视台直播的福利彩票“双色球”15011期开奖,在没有事先预告的情况下突然取消.晚上11点40分左右,中国福利彩票发行管理中心唯一指定网络信息发布媒体——中彩网官方微博出乎意料地在网上 ...

  5. jmeter的Classpath即类或者jar包的搜索路径设置

    对于master-slave模式,插件和依赖都需要放到slave上才能生效,并且需要重启slave使插件生效 查看配置文件:apache-jmeter-3.1/bin/jmeter.propertie ...

  6. vsftpd.conf案例

    1. 匿名服务器的连接(独立的服务器) 在/etc/vsftpd/vsftpd.conf配置文件中添加如下几项:Anonymous_enable=yes (允许匿名登陆)Dirmessage_enab ...

  7. C#.NET 如何在系统变量中加入新的环境变量

    比如我要将C:\Windows\Microsoft.NET\Framework\v3.5这个目录加入环境变量 则在系统的环境变量中点击Path,编辑,然后加入一个分号";",然后粘 ...

  8. CSS 全部的列表样式类型

    <html> <head> <style type="text/css"> ul.none {list-style-type: none} ul ...

  9. 通过android XML 创建图形,降低对美工的依赖

    在开发中总会须要自己定义各种View的样式,假设总是依赖美工作图弄出须要的UI样式图片(比方:一个button要选中和默认两张图片),不但时间上会浪费.往往也会有适配问题. 尽管能够通过.9图来解决一 ...

  10. Linux Shell參数扩展(Parameter Expansion)

    本文主要參考:http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 其它资料:ht ...