1076 Forwards on Weibo (30 point(s))

Python 爬虫实战:破解网页 JS 混淆加密参数 摘要:本文针对Python爬虫破解JS混淆加密参数的技术难题,系统解析了变量混淆、控制流混淆、AES/MD5加密混淆等常见类型及其检测方法,提出"定位-还原-复现"的三步破解策略。通过实战案例详细演示了从JS逆向分析到Python代码实现的完整流程,包括MD5签名生成、AES加密复现等核心代码实现,并对不同混淆场景的破解方法进行了对比分析。文中特别强调技术应用的合规性边界,指出开发者应遵守相关法律法规,在合理范围内使用逆向技术。随着反爬技术升级,建议开发者持续学习动态调试等进阶技能,同时 阅读详情

1076 Forwards on Weibo (30 point(s))

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 can view and forward his/her post, which can then be forwarded again by their followers. Now given a social network, you are supposed to calculate the maximum potential amount of forwards for any specific user, assuming that only L levels of indirect followers are counted.

Input Specification:

Each input file contains one test case. For each case, the first line contains 2 positive integers: N (≤1000), the number of users; and L (≤6), the number of levels of indirect followers that are counted. Hence it is assumed that all the users are numbered from 1 to N. Then N lines follow, each in the format:

M[i] user_list[i]

where M[i] (≤100) is the total number of people that user[i] follows; and user_list[i] is a list of the M[i]users that followed by user[i]. It is guaranteed that no one can follow oneself. All the numbers are separated by a space.

Then finally a positive K is given, followed by K UserID's for query.

Output Specification:

For each UserID, you are supposed to print in one line the maximum potential amount of forwards this user can trigger, assuming that everyone who can view the initial post will forward it once, and that only L levels of indirect followers are counted.

Sample Input:

7 3
3 2 3 4
0
2 5 6
2 3 1
2 3 4
1 4
1 5
2 2 6

Sample Output:

4
5

思路:BFS

实际上,微博关注关系图可以想象成一棵树,结点为用户,直接儿子为关注者,但是这棵树有的儿子结点在树中多次出现。本题的求解就是计算这棵树中层次小于6的不重复结点个数,容易想到用BFS(广度优先搜索)。注意到结点至多1e3个且编号为1~N,因此采用哈希思想,数组mark[]标记这些结点是否已经被计入、数组level[]记录结点所在(最低)层次。

BFS中,构建一个queue<int> q,首先把目标用户k入队。对于每个队首用户,先出队列,查找它的k的关注者,如果该关注者尚未被标记且该用户的传播层次还小于L(只有这样,该关注者传播层次才小于等于L),则cnt自加1,并标记,更新层次,将该用户入队。直到该队列为空。

注意点:

1. 输入给出的关注图,建立的vector<int> followers[N]是被关注者数组。

2. BFS流程和哈希思想。

3. BFS可用结构体Node来组合标记。

大神深度分析:https://blog.youkuaiyun.com/richenyunqi/article/details/80138420

#include<iostream>
#include<vector>
#include<queue>
#define MAX 0x3f3f3f3f
using namespace std;
const int N = 1e3+7;
vector<int> followers[N];
int bfs(int k,int L){
	int cnt = 0;
	queue<int> q;
	while(!q.empty()) q.pop();
	q.push(k);
	bool mark[N]={false};
	int level[N];
	for(int i=0;i<N;i++) level[i]=MAX;
	mark[k]=true;
	level[k]=0;
	while(!q.empty()){
		int v = q.front();
		q.pop();
		for(int i=0;i<followers[v].size();i++){
			int u = followers[v][i];
			if(mark[u]==false&&level[v]+1<=L){
				cnt++;
				mark[u]=true;
				level[u]=level[v]+1;
				q.push(u);
			}
		}
	}
	return cnt;
}
int main(void)
{
	int N,L;
	cin>>N>>L;
	int n,a,k;
	for(int i=1;i<=N;i++){
		cin>>n;
		for(int j=0;j<n;j++){
			cin>>a;
			followers[a].push_back(i);	
		}
	}
	cin>>k;
	for(int i=0;i<k;i++){
		cin>>n;
		cout<<bfs(n,L)<<endl;
	}
	return 0;
}

 

【光伏风电功率预测】基于 ICEEMDAN + MSCNN-BiGRU-Attention 的并行预测模型 本文提出一种基于ICEEMDAN分解与多尺度深度学习的光伏/风电功率并行预测框架。针对多能源、多时间尺度、强非平稳特性带来的建模挑战,该模型首先通过改进的ICEEMDAN算法将原始功率序列分解为不同频段的IMF分量;随后为每个IMF构建包含多尺度CNN、双向GRU和注意力机制的子模型,实现局部特征提取与时序依赖建模;最后通过并行预测与重构获得最终功率输出。实验表明,该方法能有效解决模式混叠问题,提升预测精度,并支持光伏/风电的独立或联合预测部署,适用于风光联合调度等工程场景。 阅读详情

相关推荐

用Matlab搞定Delta并联机器人运动学:从建模到正逆解完整流程(附代码)

本文详细介绍了如何使用Matlab实现Delta并联机器人的运动学分析,包括几何建模、正逆解求解及可视化验证。通过符号计算和数值迭代法,解决非线性方程组问题,并提供完整代码示例,帮助读者快速掌握Delta机器人的运动学计算与应用。

weixin_30955617的博客 177

【PAT甲级】1076 Forwards on Weibo (30 分)

PAT甲级1076题解

小染的学习笔记 244

保姆级教程:用SSH手动重建黑群晖RAID1阵列,修复‘存储空间损毁’

本文提供了一份详细的SSH手动重建黑群晖RAID1阵列的教程,帮助用户修复‘存储空间损毁’问题。通过深入解析mdadm软RAID的底层逻辑,从诊断到重建的全过程,确保用户能够掌握黑群晖存储池的修复技术。适用于技术爱好者和系统管理员。

weixin_30319153的博客 294

1076 Forwards on Weibo PAT甲级 BFS

【代码】1076 Forwards on Weibo PAT甲级 BFS。

m0_57882300的博客 155

Gemini Enterprise免费试用攻略:解锁企业级AI平台的隐藏技巧与避坑指南

本文详细介绍了Gemini Enterprise免费试用的全流程攻略,包括注册优化、团队协作、资源管理和典型应用场景。通过解锁企业级AI平台的核心功能如Gemini 3.0 Pro模型和Nano Banana图像生成系统,帮助企业高效评估AI与业务的契合度。文章还提供了安全合规与数据管理的实用建议,确保试用过程顺畅无忧。

weixin_29233857的博客 657

基于Pixi.js的Live2D看板娘离线加载实战指南

本文详细介绍了基于Pixi.js实现Live2D看板娘离线加载的完整方案,涵盖环境搭建、模型加载、交互功能实现及常见问题解决。通过Pixi.js的硬件加速优势,开发者可在Web和Electron项目中无缝集成离线运行的Live2D模型,提升用户体验并避免网络依赖问题。

weixin_29001423的博客 344

1076 Forwards on Weibo

算是我做的第一道30分题目吧。

DZY的博客 394

利用gprMax与Matlab实现SFCW雷达信号的高效仿真与优化

本文详细介绍了如何结合gprMax与Matlab实现SFCW雷达信号的高效仿真与优化。通过利用gprMax获取地下场景的冲激响应,并在Matlab中运用卷积与信号处理技术,可大幅提升SFCW雷达系统仿真的效率与灵活性,为探地雷达研究与设计提供强大工具。

book8的博客 707

PAT-A1076 Forwards on Weibo 题目内容及题解

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 ...

BourbonWhiskey 的博客 517

MTK Linux DRM分析(八)- KMS drm_crtc.c

CRTC 在 Linux DRM 子系统中是显示控制的核心,负责时序生成、模式设置和管线的调度。理解其工作原理和 API 对于进行底层图形开发、调试显示问题或 simply understanding how your graphics stack works 都至关重要。

iTom1900 1350

JS+H5打字练习器

实现功能 1.导入.TXT文件到打字练习内容(部分浏览器可能出于安全问题限制了这一步操作) 2.输入文本到打字练习内(弹出输入框,将要练习的内容输入至输入框) 3. 开始练习,并根据正误在打字练习内容文本上修改颜色(某个字正确显示绿色,某个字错误,显示红色,某个字没有打显示灰色) 4.开始练习、结束练习,全部输入完成后自动结束练习,也可提前手动结束练习,结束练习后弹窗用显示时和正确率。(区别在于一个全部输入完成且全部正确,一个提前结束无其他条件) 效果图 分析 HTML 结构解析 根元素:<!DO

w11111xxxl的博客 1414

1076 Forwards on Weibo(两种写法,54行代码,41行代码+详细注释)

分数 30全屏浏览题目作者 CHEN, Yue单位 浙江大学。

m0_66329385的博客 639

21天学会PCIe专栏(4.3)--PCIe配置方法

通过本节的学习,你应该对PCIe配置方法有了更深入的了解。软件配置方法包括直接访问和间接访问,可以通过特定的I/O指令或系统调用进行配置。硬件配置方法包括通过BIOS/UEFI设置和跳线设置,可以根据需要修改PCIe设备的配置参数。

xiaoheshang_123的博客 723

PAT_甲级_1076 Forwards on Weibo (30point(s)) (C++)【BFS/微博扩散】

1,题目描述 2,思路 3,AC代码 4,解题过程 第一搏 一看,这不就是有向图的DFS遍历吗?看我分分钟KO。。。

&再见萤火虫&的博客 335

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

【PAT】A1076 Forwards on Weibo (30point(s))

文章目录A1076 Forwards on Weibo (30point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis Author: CHEN, Yue Organization: 浙江大学 Time Limit: 3000 ms Memory Limit: 64 MB Co...

Duke 235

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

A1076 Forwards on Weibo (30point(s))

A1076 Forwards on Weibo (30point(s)) 题意 给出所有人follow的人,然后k次查询,输入用户id,粉丝会转发该用户的微博,层次最多为L层,输出最终有多少个人转发了该微博。 思路 千万别用dfs,dfs很难不出错。该题对图的遍历深度做了限制,一些节点可能一条路走不到,但是从另一些路径可以达到,如果用dfs的话有可能会遍历不到一些节点,因为这些节点的必经之路被堵住...

qq_43578870的博客 140

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

1076 Forwards on Weibo (30 point(s))

1076 Forwards on Weibo (30 point(s)) 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

佳迪斯的博客 133

1076 Forwards on Weibo (30 point(s))

题解 bfs。 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;queue&gt; #include&lt;cstring&gt; using namespace std; const int MAXN = 1e3 + 10; struct node { int level, id; }; bool vis[MAX...

徐伯莱 320

PTA 甲级 1076 Forwards on Weibo (30 point(s))

1076 Forwards on Weibo (30 point(s)) 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 for...

忘梦心的博客 308

PAT(甲级)1076 Forwards on Weibo (30point(s))

题目 题目链接 思路 题目大意:给一个社交网络,当一个博主发布动态后其关注者会进行转发,在一定的转发层数内求出一共有多少个人转发该动态; 先用邻接表把网络关系存储下来,为什么要用邻接表,因为不涉及权值问题; 对于给定博主,采用BFS的做法迭代,注意在对每个博主进行BFS时,要将vis数组整体赋值为false,用于记录一个用户是否入过队,不能重复入队(即不能重复转发); 至于层数的控制,需要每次入队前判断这个元素所在层数是否小于等于k; 代码 #include <iostream> #includ

hjyp的博客 178

1076 Forwards on Weibo (30point(s)) - C语言 PAT 甲级

使用队列实现广度优先遍历 * 每人仅转发一次,即不可重复入队 * 广度遍历时,判断最大层数不超过 L 层

有三只土豆 167

PAT(A) 1076 Forwards on Weibo (30 point(s))

图的遍历,BFS(优),DFS 法一:BFS(优) 疑问:为什么case1&4有Segmentation Fault???抓脑壳 #include<bits/stdc++.h> using namespace std; int N, L, K; vector<vector<int>> M; int bfs(int root){ int cnt = 0, vis[1010] = {0}, lvl[1010]; queue<int> q

Anpotan的博客 103

【1076】Forwards on Weibo (30 分)

#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #inclu...

发现问题,并解决问题,批判性思维 727

PAT 1076. Forwards on Weibo (30)

1076. Forwards on Weibo (30) 时间限制 3000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Weibo is known as the Chinese version o

FrozenShore 1033

1076 Forwards on Weibo (30 分)

知识点:图的遍历 用了邻接表我也不知道为啥变慢了,然后本题比较适合使用bfs,如果用dfs的话比较难,考验你的水平,可以尝试, #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define sz(x) ((int) x.size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long

weixin_46709784的博客 157

1076 Forwards on Weibo (30 分)--PAT甲级

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 wit...

laplacebh的博客 494
上一篇: 1078 Hashing (25 point(s))
下一篇: 1100 Mars Numbers (20 point(s))
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值