poj 3660
来源:互联网 发布:python 类型判断 编辑:程序博客网 时间:2024/05/29 04:20
水题,floyd
#include<cstring>#include<cstdio>#include<cmath>#include<algorithm>using namespace std;int g[110][110];int main(){ int i,j,k,n,m; scanf("%d %d",&n,&m); memset(g,-1,sizeof(g)); for(i=1;i<=m;i++){ int x,y; scanf("%d %d",&x,&y); g[x][y]=1; } for(k=1;k<=n;k++) for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(g[i][k]==1 && g[k][j]==1) g[i][j]=1; int ans=0; for(i=1;i<=n;i++){ int tmp=0; for(j=1;j<=n;j++) if(g[i][j]==1 || g[j][i]==1) tmp++; if(tmp==n-1)ans++; } printf("%d\n",ans);}
- poj 3660
- poj 3660
- poj 3660
- POJ 3660
- POJ 3660
- poj---3660
- POJ 3660
- poj 3660
- poj 3660
- POJ 3660
- POJ 3660
- poj 1125 , poj 3660 floyd
- poj 3660 Cow Contest
- POJ 3660 Cow Contest
- POJ 3660 floyd 算法
- POJ 3660 Cow Contest
- poj 3660 Cow Contest
- POJ-3660-Cow Contest
- JSP基础语法之八:session对象,简单登录模块(session+JDBC)
- 只能上QQ不能上网
- UVA 4995 —— Map的使用
- 数据库基础学习----SQL语句的连接方式
- Java基础教程 01
- poj 3660
- [转载]MyEclipse 8.5 注册码生成器(java版)
- CoreData基础
- C语言深度解剖 关键知识总结
- 简单题练习——二叉搜索树的后序遍历序列
- 一步一步教你网站采集规则
- Windows 配置java运行环境
- 简单题练习——数字在排序数组中出现的次数
- 在WINDOWS XP搭建服务器网卡启动安装Linux