Density of Power Network

本文介绍了一个简单的算法,用于计算电力网络的密度。该算法通过分析电力网络中的节点(即变电站)和边(即输电线路)来评估网络的健壮性。网络密度定义为输电线路数量与变电站数量之比。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Density of Power Network

Time Limit: 2 Seconds      Memory Limit: 65536 KB

The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In real world, the power system may contains hundreds of buses and thousands of transmission lines.

Network topology analysis had long been a hot topic in the research of power system. And network density is one key index representing the robustness of power system. And you are asked to implement a procedure to calculate the network density of power system.

The network density is defined as the ratio between number of transmission lines and the number of buses. Please note that if two or more transmission lines connecting the same pair of buses, only one would be counted in the topology analysis.

Input

The first line contains a single integer T (T ≤ 1000), indicating there are T cases in total.

Each case begins with two integers N and M (2 ≤ NM ≤ 500) in the first line, representing the number of buses and the number of transmission lines in the power system. Each Bus would be numbered from 1 to N.

The second line contains the list of start bus number of the transmission lines, separated by spaces.

The third line contains the list of corresponding end bus number of the transmission lines, separated by spaces. The end bus number of the transmission lines would not be the same as the start bus number.

Output

Output the network density of the power system in a single line, as defined in above. The answer should round to 3 digits after decimal point.

Sample Input
3
3 2
1 2
2 3
2 2
1 2
2 1
14 20
2 5 3 4 5 4 5 7 9 6 11 12 13 8 9 10 14 11 13 13
1 1 2 2 2 3 4 4 4 5 6 6 6 7 7 9 9 10 12 14
Sample Output
0.667
0.500
1.429

    水题,只要将所有的连接的两点的坐标记录下来,当是一条边,就基本上解决问题了。
AC代码:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
using namespace std;
const int T = 0x3f3f3f3f;
struct S
{
	int l,r;
	friend bool operator<(const S&a ,const S& b)
	{
		return a.l>b.l||(a.l==b.l&&a.r>b.r);
	}
}str[550];
int main()
{
	set<S> a;
	int N,n,m,i,k;
	scanf("%d",&N);
	double t;
	while(N--)
	{
		scanf("%d%d",&n,&m);
		k=0;
		for(i=0;i<m;++i)
		{
			scanf("%d",&str[i].l);
		}
		for(i=0;i<m;++i)
		{
			scanf("%d",&str[i].r);
			if(str[i].r!=str[i].l)
			{
				if(str[i].l>str[i].r)swap(str[i].l,str[i].r);
				a.insert(str[i]);
			}
		}
	/*	set<S>::iterator it;
		for(it=a.begin();it!=a.end();++it)
		{
			printf(" %d %d\n",it->l,it->r);
		}*/
		k=a.size();
		t = (k*1.0)/n;
		printf("%.3lf\n",t);
		a.clear();
	}
	return 0;
}


Network Requirements Analysis: Coverage Areas: Bar/Dining Area (High Density) 20 Motel Rooms (Separate Unwired Building) Key Needs: Secluded guest WiFi (isolated from internal networks) Access Point-only solution (Starlink router handling routing) Wireless backhaul for unwired building High client capacity (guests + staff devices) Recommended Solution 1. Core Infrastructure Controller: Omada OC200/OC300 (mandatory for centralized management of APs, VLANs, and captive portal) PoE Switch: TL-SG2210P (to power APs via PoE) 2. Recommended Access Points 1. EAP683-UR (AX6000 Ceiling Mount) Why: 185㎡ coverage per unit (ideal for motel rooms) 510+ concurrent clients capacity (handles 20 rooms + common areas) Omada Mesh for wireless backhaul to unwired building 4×5 GHz antennas + HE160 for high-density areas VLAN support for network isolation 2. EAP653-UR (AX3000 Ceiling Mount) Alternative Option: 185㎡ coverage with 250+ client capacity Lower cost while still supporting mesh and VLANs Better for budget-conscious deployments 3. EAP723 (Wi-Fi 7 BE5000) Future-Proof Option: BE5000 speeds (688Mbps 2.4GHz + 4324Mbps 5GHz) 250+ client capacity with OFDMA/MU-MIMO Backward compatible with existing devices Deployment Plan Bar/Dining Area: 1× EAP683-UR (central ceiling mount) 1× EAP653-UR (edge coverage extension) Motel Building: 3× EAP683-UR (mesh configuration) 1 unit at building entrance + 2 units staggered down corridors Key Configuration: Separate SSID with VLAN isolation Band steering to 5GHz Client limit per AP to prevent congestion Scheduled reboots (2AM daily) Validation Recommendation You can use Omada Design Center to validate this solution. ODC is a pre-sales planning platform that provides: Automated heatmap simulation Equipment quantity optimization Interference analysis between APs Standardized deployment reports Would you like me to elaborate on any specific aspect?这段话呢
08-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值