ZOJ Problem Set - 3708 Density of Power Network
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3708
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int T,i,j,lineSum;
int N,M;
int x[505],y[505];
int lineL [505][505] ; scanf("%d",&T);
for(i = 0 ; i < T ;i++){
lineSum = 0;
scanf("%d %d",&N,&M); memset (lineL,0,sizeof(lineL));
memset (lineL,0,sizeof(x));
memset (lineL,0,sizeof(y)); for(j = 0 ; j < M ;j++){
scanf("%d",&x[j]);
}
for(j = 0 ; j < M ;j++){
scanf("%d",&y[j]);
}
for(j = 0 ; j < M ;j++){
if(lineL[x[j]][y[j]] == 0 && lineL[y[j]][x[j]] == 0){ lineSum ++;
lineL[x[j]][y[j]]=lineL[y[j]][x[j]]=1; }
}
printf("%.3f\n",lineSum/(N*1.0));
} return 0;
}
ZOJ Problem Set - 3708 Density of Power Network的更多相关文章
- [ACM_图论] ZOJ 3708 [Density of Power Network 线路密度,a->b=b->a去重]
The vast power system is the most complicated man-made system and the greatest engineering innovatio ...
- zoj 3708 Density of Power Network
/*看英文和图我头都大了,不过很简单的.*/ #include<string.h> #include<stdio.h> ][],q[],w[]; int main(int ar ...
- Density of Power Network(ZOJ 3708)
Problem The vast power system is the most complicated man-made system and the greatest engineering i ...
- ZOJ3708:Density of Power Network
The vast power system is the most complicated man-made system and the greatest engineering innovatio ...
- POJ1459:Power Network(多源点多汇点的最大流)
Power Network Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 31086 Accepted: 15986 题 ...
- POJ 1459 Power Network / HIT 1228 Power Network / UVAlive 2760 Power Network / ZOJ 1734 Power Network / FZU 1161 (网络流,最大流)
POJ 1459 Power Network / HIT 1228 Power Network / UVAlive 2760 Power Network / ZOJ 1734 Power Networ ...
- poj1459 Power Network (多源多汇最大流)
Description A power network consists of nodes (power stations, consumers and dispatchers) connected ...
- Power Network(网络流最大流 & dinic算法 + 优化)
Power Network Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 24019 Accepted: 12540 D ...
- Power Network 分类: POJ 2015-07-29 13:55 3人阅读 评论(0) 收藏
Power Network Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 24867 Accepted: 12958 Descr ...
随机推荐
- mybatis递归查询
<!--mybatis递归查询--><resultMap id="recursionMenuMap" type="AgentMenu" ext ...
- LOJ-10094(强连通分量)
题目链接:传送门 思路: 先缩点,然后统计入度为0的点即可. #include<iostream> #include<cstdio> #include<cstring&g ...
- ScrollView无法滚动
ScrollView视图无法滚动 箭头所指地方应该用dp单位的数值
- while read line 查找指定日期的文件夹
#!/bin/bash dir=/root/tmp targetdir=/root/tmp/tmp filenametxt=/tmp/filename.txt commandtxt=/tmp/comm ...
- 基于IP的docker private registry 私有仓库的搭建
鉴于国内的网络环境,如果公司内部大量使用docker,镜像上传下载将是个非常耗时的工作,搭建一个私有仓库可以很好的解决自有镜像的存储,如果你在私有网络,不能使用域名的话,那么本文可以作为一个很好的例子 ...
- banner
依赖 compile 'com.youth.banner:banner:+' 主Activity private void bannerLunBo() { MyBanner.setImageLoade ...
- Xaml引用图片路径的方式
最近写代码的时候遇到过好几次引用某个路径下图片资源的情况,思索了一下,便将自己所知的在xaml里引用图片资源的方法写成了个小Demo,并完成了这篇博文.希望罗列出的这些方式能够对大家有所帮助. Xam ...
- Sqlalchemy python经典第三方orm
Ⅰ. 安装 pip install sqlalchemy Ⅱ. 起步链接 import time import threading import sqlalchemy from sqlalchemy ...
- CS61B HW0
The Enhanced For Loop public class EnhancedForBreakDemo { public static void main(String[] args) { S ...
- QEMU Networking
QEMU Networking QEMU has a number of really nice ways to set up networking for its guests. It can be ...