题目传送门

 /*
构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件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. 2015山东信息学夏令营 Day5T3 路径

    问题描述: 给定平面上的n个点,定义(x1,y1)到(x2,y2)的费用为min(|x1-x2|,|y1-y2|),求从1号点走到n号点的最小费用. 输入: 第一行包含一个正整数n,表示点数. 接下来 ...

  2. Kafka 生产消费 Avro 序列化数据

    https://unmi.cc/kafka-produce-consume-avro-data/ https://unmi.cc/apache-avro-serializing-deserializi ...

  3. Servlet发送邮件

    以下内容引用自http://wiki.jikexueyuan.com/project/servlet/sending-email.html: 使用Servlet发送一封电子邮件是非常简单的,但是开始之 ...

  4. 纯css3实现按钮的 hover 和 active 时颜色的明暗变化效果

    效果:在任意HTML标签上增加样式类 f-color-control 就可以为此元素增加hover和avtive时颜色的变化; 代码如下: <!DOCTYPE html> <html ...

  5. java和c/c++通过JNI相互调用

    JNI :Java Native Interface 随便找几篇文章看下就掌握了 http://www.cnblogs.com/icejoywoo/archive/2012/02/22/2363709 ...

  6. ThinkPHP3.2 点击看不清刷新验证码

    欢迎使用Markdown编辑器写博客 baidu了一下.发现没有可用的源码,自己想了想,以下的方法可行. <!DOCTYPE html> <html> <head> ...

  7. hdu 5288 OO’s Sequence(2015 Multi-University Training Contest 1)

    OO's Sequence                                                          Time Limit: 4000/2000 MS (Jav ...

  8. python之SocketServer编程

    编写一个SocketServer需要实现以下步骤 编写一个handler类,继承BaseRequestHandler,重写handle()方法 针对是TCP还是UDP,生成一个server对象 调用s ...

  9. (6)文本挖掘(三)——文本特征TFIDF权重计算及文本向量空间VSM表示

    建立文本数据数学描写叙述的过程分为三个步骤:文本预处理.建立向量空间模型和优化文本向量. 文本预处理主要採用分词.停用词过滤等技术将原始的文本字符串转化为词条串或者特点的符号串.文本预处理之后,每个文 ...

  10. android仿qq空间、微信朋友圈图片展示

    废话不多说,先上效果图 由于近期须要做朋友圈功能,所以在此记录一下,事实上非常多人不明确的一点应该是在图片的排列上面吧,不规则的排列,事实上非常easy的.就是一个GridView.然而你xml光光写 ...