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的更多相关文章

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

  2. zoj 3708 Density of Power Network

    /*看英文和图我头都大了,不过很简单的.*/ #include<string.h> #include<stdio.h> ][],q[],w[]; int main(int ar ...

  3. Density of Power Network(ZOJ 3708)

    Problem The vast power system is the most complicated man-made system and the greatest engineering i ...

  4. ZOJ3708:Density of Power Network

    The vast power system is the most complicated man-made system and the greatest engineering innovatio ...

  5. POJ1459:Power Network(多源点多汇点的最大流)

    Power Network Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 31086   Accepted: 15986 题 ...

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

  7. poj1459 Power Network (多源多汇最大流)

    Description A power network consists of nodes (power stations, consumers and dispatchers) connected ...

  8. Power Network(网络流最大流 & dinic算法 + 优化)

    Power Network Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 24019   Accepted: 12540 D ...

  9. Power Network 分类: POJ 2015-07-29 13:55 3人阅读 评论(0) 收藏

    Power Network Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 24867 Accepted: 12958 Descr ...

随机推荐

  1. python 模块——os 模块

    os 模块--操作系统的各种接口 常用函数: os.path os.path.join(path,*paths) (常用,设置文件路径)将一个或者多个路径连接起来. PATH_TO_TEST_IMAG ...

  2. java中如何使用break跳出多重循环

    java 中已知的三种跳出多重循环的方式: System.out.println("---------java中跳出多重循环的三种方式:---------"); System.ou ...

  3. h5 调起ios数字键盘的坑,限制特殊字符输入方案

    最近有个需求是利率只允许输入数字和小数点,用以下 <input type="number" pattern="[0-9]*"> 在ios会调起数字键 ...

  4. JSOI2018 简要题解

    潜入行动 复杂度分析题. 定义状态fi,j,0/1,0/1f_{i,j,0/1,0/1}fi,j,0/1,0/1​表示以iii为根子树放jjj个机器iii这个放不放,iii这个是否已放来进行dpdpd ...

  5. 第49章:MongoDB-数据导入导出

    ①导出工具mongoexport Mongodb中的mongoexport工具可以把一个collection导出成JSON格式或CSV格式的文件.可以通过参数指定导出的数据项,也可以根据指定的条件导出 ...

  6. JS模块化工具require.js教程(一):初识require.js

    随着网站功能逐渐丰富,网页中的js也变得越来越复杂和臃肿,原有通过script标签来导入一个个的js文件这种方式已经不能满足现在互联网开发模式,我们需要团队协作.模块复用.单元测试等等一系列复杂的需求 ...

  7. 【repost】让你一句话理解闭包(简单易懂)

    接触javascript很久了,每次理解闭包都似是而非,最近在找Web前端的工作,所以需要把基础夯实一下. 本文是参照了joy_lee的博客 闭包 在她这篇博客的基础上以批注的形式力争把我的理解阐述出 ...

  8. noip第22课资料

  9. WebPackBrows

    一个http工具,通过java编写 调用方法 s.y.webpackbrows.fac.WebPackFactor.getConnection 还会继续完善 下载位置 https://pan.baid ...

  10. 深入Java集合学习系列:LinkedHashMap的实现原理

    参考下面链接: http://zhangshixi.iteye.com/blog/673789