#include
#include
#include
const int N=305;
using namespace std;
int main()
{
int cas=0,n,m,q,i,j,k,x,y,t,g[305][305],vis[305],inf=1<<30;
while(~scanf("%d%d%d",&n,&m,&q))
{
if(n==0) break;
if(cas) printf("\n");
memset(vis,0,sizeof(vis));
for(i=0; it) g[x][y]=t;
}
printf("Case %d:\n",++cas);
for(k=0;k=inf) printf("No such path\n");
else printf("%d\n",g[x][y]);
}
else
{
scanf("%d",&x);
if(vis[x])
{
printf("ERROR! At point %d\n",x);
}
else
{
vis[x]=1;
for(i=0;i=inf||g[x][j]>=inf) continue;
g[i][j]=min(g[i][j],g[i][x]+g[x][j]);
}
}
}
}
}
return 0;
}
錯誤代碼
/* ***********************************************
Author :xryz
Email :[email protected]
Created Time :6-10 22:57:56
File Name :a.cpp
************************************************ */
#include
#include
#include
#include
#include
#include
#include
#include