HDU--4043(Graph)
来源:互联网 发布:ubuntu 文件格式 编辑:程序博客网 时间:2024/05/16 03:01
The Meanings Of Problem:
就是给你一个图,给出了两点之间的最小路径,让你判断这样的原先的图存不存在...要是存在输出边的数目
Subjects Catagories:
Floyded
Codes:
- #pragma warning(disable:4786)
- #include<iostream>
- #include<algorithm>
- using namespace std;
- const int MAXN =101;
- typedef struct{
- int num;
- int map[MAXN][MAXN];
- }Graphics;
- int main(){
- int nCase;
- Graphics graphics;
- cin>>nCase;
- for(int i=1;i<=nCase;i++){
- cin>>graphics.num;
- for(int ii=0;ii<graphics.num;ii++){
- for(int j=0;j<graphics.num;j++){
- cin>>graphics.map[ii][j];
- }
- }
- bool flag = true;
- int count = 0;
- for(ii=0;ii<graphics.num&&flag;ii++){
- for(int j=0;j<graphics.num&&flag;j++){
- if(ii==j)
- continue;
- int flag_1 = 0;
- for(int k=0;k<graphics.num&&flag;k++){
- if(ii==k||j==k)
- continue;
- if(graphics.map[ii][j]>graphics.map[ii][k]+graphics.map[k][j]){
- flag =false;
- break;
- }else{
- if(graphics.map[ii][j]==graphics.map[ii][k]+graphics.map[k][j]){
- flag_1 = 1;
- break;
- }
- }
- }
- if(flag_1==0)
- count++;
- }
- }
- if(flag)
- cout<<"Case "<<i<<":"<<" "<<count<<endl;
- else
- cout<<"Case "<<i<<":"<<" "<<"impossible"<<endl;
- }
- return 0;
- }
0 0
- HDU--4043(Graph)
- HDU--4043(Graph)
- HDU 4034 Graph
- HDU 4365 - Palindrome graph
- HDU 4365 - Palindrome graph
- hdu 4034 floyd Graph
- hdu 4467 Graph
- hdu 4034 Graph (floyd)
- hdu 4034 graph
- hdu 4467 Graph
- hdu 4365 Palindrome graph
- hdu 3732 Graph Reconstruction
- HDU 4034(Graph)
- hdu 4034 - Graph
- HDU 4797 Graph Reconstruction
- hdu 5313 Bipartite Graph
- hdu-5313 Bipartite Graph
- hdu 5313 Bipartite Graph
- 待字闺中之对移动搜索的一些思考
- C++容器:容器的基本操作
- 《CSS权威指南》笔记-选择器
- 2003 - Can't connect to MySQL server on 'localhost' (10061)
- HDU--4027(Can you answer these queries?)
- HDU--4043(Graph)
- STL algorithm算法copy_if(8)
- centos挂在一个共享文件夹
- 蜕变
- MyEclipse中配置struts.xml自动提示
- char 与 unsigned char的本质区别
- 待字闺中之最大乘积
- how to install phpmyadmin on centos6
- “与银行预留的手机号码不一致”的问题解决方法