1155. Can I Post the lette
来源:互联网 发布:上海淘宝公司 编辑:程序博客网 时间:2024/05/26 05:52
#include "iostream"#include "memory.h"#include "cstdio"using namespace std;int road[201][201];int n, m;/*利用弗洛伊德算法来解这道题,如果两个城市可以连通,则其距离为0*/inline void floyd(){for (int i = 0; i < n; i++){for (int j = 0; j < n; j++){for (int k = 0; k < n; k++){if (road[j][k] > (road[j][i] + road[i][k])){road[j][k] = road[j][i] + road[i][k];}}}}}int main(){while (cin >> n && n){if (0 == n)break;for (int i = 0; i < 201; i++){for (int j = 0; j < 201; j++){road[i][j] = 100;}road[i][i] = 0;}cin >> m;for (int i = 0; i < m; i++){int a, b;cin >> a >> b;road[a][b] = 0;road[b][a] = 0;}floyd();if (road[0][n - 1] == 0){printf("I can post the letter\n");}else{printf("I can't post the letter\n");}}return 0;}
0 0
- Sicily 1155. Can I Post the lette
- 1155. Can I Post the lette
- sicily 1155. Can I Post the lette
- 1155. Can I Post the lette
- Sicily 1155. Can I Post the lette
- 1155. Can I Post the lette
- sicily 1155. Can I Post the lette
- Can I Post the lette
- sicily1155. Can I Post the lette
- 算法学习【12】—— 1155. Can I Post the lette
- [sicily online]1155. Can I Post the lette(图的深度优先搜索)
- sicily:1155.Can I Post the letter
- Sicily 1155. Can I Post the letter
- sicily 1155 Can I Post the letter
- Sicily 1155 Can I Post the letter
- sicily 1155 Can i post the letter
- <OJ_Sicily>Can I Post the letter
- 1155. Can I Post the letter(有向图遍历判断两点是否可到达)
- SWIFT是什么意思?
- jquery flot 画柱状图
- First集Follow集通俗易懂的讲解加实例
- 5个典型的JavaScript面试题
- Lucene - Overview
- 1155. Can I Post the lette
- 【BZOJ】【P1976】【BeiJing2010组队】【能量魔方 Cube】【题解】【最小割】
- Zxing调整扫描区域 优化取图速度
- 用Drawerlayout来实现侧滑效果
- snprintf比sprintf好,那么strncpy就比strcpy好?!
- python特殊语句
- 【MongoDB for Java】Java操作MongoDB
- 课程设计
- 再来5个JavaScript面试题