题目链接

https://www.patest.cn/contests/gplt/L2-019

思路

将已关注的人 用 MAP存起来

然后将点赞的用户中 没有关注的 用 VECTOR 存下来 并且求出 SUM

再遍历那个 VECTOR 用另一个VECTOR 存下 点赞数 大于平均数 的人

最后 排序 输出

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <string, int> psi; const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6; const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7; int main()
{
map <string, int> m;
int n;
scanf("%d", &n);
string s;
for (int i = 0; i < n; i++)
{
cin >> s;
m[s] = 1;
}
scanf("%d", &n);
double sum = 0.0;
int num;
vector <psi> v;
vector <string> ans;
for (int i = 0; i < n; i++)
{
cin >> s;
scanf("%d", &num);
sum += num;
if (m[s] == 0)
v.push_back(psi(s, num));
}
sum = sum * 1.0 / n;
vector <psi>::iterator it;
for (it = v.begin(); it != v.end(); it++)
{
if ((*it).second > sum)
ans.push_back((*it).first);
}
if (ans.size())
{
sort(ans.begin(), ans.end());
vector <string>::iterator iter;
for (iter = ans.begin(); iter != ans.end(); iter++)
cout << (*iter) << endl;
}
else
printf("Bing Mei You");
}

最新文章

  1. 0038 Java学习笔记-多线程-传统线程间通信、Condition、阻塞队列、《疯狂Java讲义 第三版》进程间通信示例代码存在的一个问题
  2. flask笔记1-安装
  3. android Sqlite select * from myDatabase没有内容的问题
  4. Raspberry PI B+ debian + wifi 网络设置
  5. 微信、qq信息汇总、回复(一)
  6. poj 2709
  7. 深入理解JAVA I/O系列六:Linux中的IO模型
  8. Linux重置mysql密码(转载)
  9. PAT1075. PAT Judge
  10. 【JavaScript】HTML5/CSS3实现五彩进度条应用
  11. CH Round #52 - Thinking Bear #1 (NOIP模拟赛)
  12. javascript 学习随笔
  13. Jquery中日期插件jquery.datepick的使用
  14. 第一天上午——HTML网页基础知识以及相关内容
  15. 码农很忙代理IP系统V1.0版本上线
  16. CSS 静态进度条效果
  17. 洛谷P2278操作系统
  18. Not supported for DML operations
  19. uniGUI试用笔记(十一)
  20. python爬虫之一:requests库

热门文章

  1. JS 导出Table为excel的三种可行方法
  2. CentOS 安装rz和sz
  3. 腾讯云DevOps 解决方案
  4. squid cache 服务器端的安装,配置
  5. lua学习笔记(十一)
  6. git 修改远程仓库地址
  7. laravel学习之路2: jwt集成
  8. [转]postman 官方文档解说
  9. Socket网络编程TCP、UDP演示样例
  10. Myeclipse 选中高亮