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. 初入TensorFlow————配置TensorFlow

    能看到这说明你对python已经有一定的了解了,因此很多基础直接跳过. 一.TensorFlow环境配置: TensorFlow的环境配置在网上很多的教程都是用anaconda的方式,但是很容易出现冲 ...

  2. Spring学习-01

    一.Srping 一个轻量级DI.IOC.AOP的容器框架 DI:依赖注入 IOC:控制反转 AOP:面向切面 二.构造器注入 Constructor-arg 属性:index/name/type/r ...

  3. hbase常用操纵操作——增删改查

    查询某个资金账户的信息 get 'dmp:hbase_tags','资金账号' 创建表 create 'emp', 'personal data', 'professional data' 在HBas ...

  4. Blueking bk 蓝鲸开发环境搭建

    首先根据文档安装各种东西 http://docs.bk.tencent.com/develop_center/ops/unified.html#installation 完后在在vagrantfile ...

  5. Exp9 Web安全基础

    Exp9 Web安全基础 20154305 齐帅 一.实验要求 本实践的目标理解常用网络攻击技术的基本原理. Webgoat实践下相关实验: [目录] [第一部分 WebGoat 8.0] 1.Web ...

  6. 所有子节点、Procedure、MySQL

    在Oracle 中我们知道有一个 Hierarchical Queries 通过CONNECT BY 我们可以方便的查了所有当前节点下的所有子节点.但很遗憾,在MySQL的目前版本中还没有对应的功能. ...

  7. SpringBoot 基础01

    SpringBoot 基础 pom.xml <!-- Spring Boot 依赖版本控制 --> <parent> <groupId>org.springfram ...

  8. ServiceStack.Redis记录

    一.事务 (一)AcquireLock方法 1.说明:申请对一个Key加锁(期间其他对象不能访问). 2.带using的使用,或带过期时间参数,否则锁不会自动释放. using (RedisCache ...

  9. oracle数据导入

    1.删除原有数据库的内容 drop user username cascade; 我的数据库名为test,所以sql语句为: drop user test cascade; 2.创建表空间: 语句为: ...

  10. hbuilder下用plus.barcode.Barcode做二维码扫描,当二维码容器的高度设置过低时,启动扫描会发生闪退

    解决办法: 将固定高度改为百分比