PAT 1076 Forwards on Weibo[BFS][一般]】的更多相关文章

1076 Forwards on Weibo (30)(30 分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a pos…
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followers…
#include <cstdio> #include <cstdlib> #include <vector> #include <queue> #include <unordered_set> using namespace std; class User { public: vector<int> fellowers; bool visited; User(): visited(false){} }; int query(int i…
1076 Forwards on Weibo (30分)   Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post o…
PAT甲级1076. Forwards on Weibo 题意: 微博被称为中文版的Twitter.微博上的一位用户可能会有很多关注者,也可能会跟随许多其他用户.因此,社会网络与追随者的关系形成.当用户在微博上发布帖子时,他/她的所有跟随者可以查看和转发他/她的帖子,然后可以由他们的追随者再次转发. 现在给出一个社交网络,假定只计算间接跟随者的L个级别,您应该计算任何特定用户的最大潜在潜在金额. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第一行包含2个正整数:N(<= 1000),…
题目信息 1076. Forwards on Weibo (30) 时间限制3000 ms 内存限制65536 kB 代码长度限制16000 B Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with follo…
1076 Forwards on Weibo (30 分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on…
题目 Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followe…
题目大意:给出每个用户id关注的人,和转发最多的层数L,求一个id发了条微博最多会有多少个人转发,每个人只考虑转发一次.用BFS,同时每个节点要记录下所在的层数,由于只能转发一次,所以每个节点要用vis判断之前是否入过队列,不能重复入队. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include…
题目如下: Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her foll…