读懂题意就简单了

#include<stdio.h>
#define inf 999999999
#define N 310
int f[N];
int map[N][N];
int main() {
int n,m,i,j,k,a,b,max,ans;
while(scanf("%d%d",&n,&m)!=EOF) {
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
map[i][j]=inf;
while(m--) {
scanf("%d",&k);
for(j=1;j<=k;j++)
scanf("%d",&f[j]);
for(j=1;j<=k;j++)
for(a=j+1;a<=k;a++)
map[f[j]][f[a]]=map[f[a]][f[j]]=1;
}
for(k=1;k<=n;k++)
for(i=1;i<=n;i++)
for(j=1;j<=n;j++) {
if(i==j||i==k)continue;
if(map[i][j]>map[i][k]+map[k][j])
map[i][j]=map[i][k]+map[k][j];
}
max=inf;
for(i=1;i<=n;i++) {
ans=0;
for(j=1;j<=n;j++)
if(i!=j)
ans+=map[i][j];
if(max>ans)
max=ans;
}
printf("%d\n",max*100/(n-1));
}
return 0;
}

poj 2139 flord水题的更多相关文章

  1. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  2. poj 3264 RMQ 水题

    题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...

  3. Poj 1552 Doubles(水题)

    一.Description As part of an arithmetic competency program, your students will be given randomly gene ...

  4. 最小费用最大流模板 poj 2159 模板水题

    Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 15944   Accepted: 8167 Descr ...

  5. POJ 1837 Balance 水题, DP 难度:0

    题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物 ...

  6. POJ - 3090 gcd水题

    大概题意就是求\(1 \le i,j \le n\)的\(gcd(i,j) = 1\)的个数+2(对于0的特判) 正解应该是欧拉函数或者高逼格的莫比乌斯反演 但数据实在太水直接打表算了 /*H E A ...

  7. POJ 1654 Area(水题)

    题目链接 卡了一下精度和内存. #include <cstdio> #include <cstring> #include <string> #include &l ...

  8. POJ 3080 (字符串水题) Blue Jeans

    题意: 找出这些串中最长的公共子串(长度≥3),如果长度相同输出字典序最小的那个. 分析: 用库函数strstr直接查找就好了,用KMP反而是杀鸡用牛刀. #include <cstdio> ...

  9. POJ 2365 Rope(水题)

    [题意简述]:给出我们钉子个数与半径,让我们求出缠绕在钉子上的绳子有多长. [分析]:从题目中我们能够看出,绳子长度的和等于每两个钉子的距离的和加上接触在钉子上的绳子的长度,不难发现这部分长度事实上就 ...

随机推荐

  1. winform设置超时时间

    ); //设置超时时间 var completedTask = await Task.WhenAny(new Task(async () => { );//执行的方法示例这里用延迟代替 }), ...

  2. 数据结构之---C语言实现共享栈

    所谓共享栈是两个栈在一个顺序的存储空间中.两个栈的栈底各自是存储空间的首尾地址. 如图我们能够将两个栈构造成一个: 如图: 从这里也就能够分析出来,栈1为空时,就是top1等于-1时.而当top2等于 ...

  3. HDU1561 The more, The Better

    HDU1561 The more, The Better Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  4. Gym-101915C Shahhoud Training Hussain 模拟

    题面 题意:每天有K本书,你最多看P本一天,问N天后多少本书没有看 题解:ans=(K-P)*N; 注意一点就是P>=K的时候,ans=0; #include<bits/stdc++.h& ...

  5. Qt5.9 WebChannel

    Qt WebChannel enables peer-to-peer communication between a server (QML/C++ application) and a client ...

  6. 浅谈Python Web 框架:Django, Twisted, Tornado, Flask, Cyclone 和 Pyramid

    Django Django 是一个高级的 Python Web 框架,支持快速开发,简洁.实用的设计.如果你正在建一个和电子商务网站相似的应用,那你应该选择用 Django 框架.它能使你快速完成工作 ...

  7. Codeforces 680D Bear and Tower of Cubes 贪心 DFS

    链接 Codeforces 680D Bear and Tower of Cubes 题意 求一个不超过 \(m\) 的最大体积 \(X\), 每次选一个最大的 \(x\) 使得 \(x^3\) 不超 ...

  8. Vue报错笔记

    1.错误信息:[Vue warn]: Property or method "object" is not defined on the instance but referenc ...

  9. 如何解决Android 5.0以上出现的警告:Service Intent must be expli

    有些时候我们使用Service的时需要采用隐私启动的方式,但是Android 5.0一出来后,其中有个特性就是Service Intent  must be explitict,也就是说从Lollip ...

  10. Centos7下git服务器及gogs部署

    1.安装git # yum install -y git 2.创建git用户及组 # groupadd git # adduser git -g git # mkdir /home/git # mkd ...