您当前的位置: 首页 > 

MangataTS

暂无认证

  • 4浏览

    0关注

    423博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

L2-019 悄悄关注(STL)

MangataTS 发布时间:2022-04-05 20:41:06 ,浏览量:4

题目连接

https://pintia.cn/problem-sets/994805046380707840/problems/994805059731177472

思路

对于关注列表的名字,我们通过一个map进行标记是否出现,然后下面的用户和点赞信息可以通过pair进行存储,最后遍历一遍点赞的用户,找出其中不在关注用户且点赞数量大于平均的人,最后排序输出即可,如果没有的话输出Bing Mei You

代码
#include
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
#define INF 0x3f3f3f3f

int n,m;

map vis;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	string name;
	for(int i = 1;i >name;
		vis[name] = true;
	}
	cin>>n;
	int star,sum = 0;
	vector Vec;
	for(int i = 1;i >name>>star;
		Vec.push_back({name,star});
		sum += star;
	}
	vector ans;
	for(int i = 0;i  sum && vis[Vec[i].first] == false) 
			ans.push_back(Vec[i].first);
	}
	if(ans.size() == 0) cout            
关注
打赏
1665836431
查看更多评论
0.0356s