神奇报错
  • 板块学术版
  • 楼主yaodiguoan
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/4/4 17:18
  • 上次更新2024/4/4 17:36:53
查看原帖
神奇报错
1023793
yaodiguoan楼主2024/4/4 17:18

#include <bits/stdc++.h>
using namespace std;
#define hh putchar('\n')
#define kg putchar(' ')
#define debug puts("debug")
//#define int long long
//#define int __int128
namespace quickread{
	inline int read(){
		int x=0,f=1;char ch=getchar();
		while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
		while (ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
		return x*f;
	}
	inline void write(int x){
	    if(x<0){putchar('-');x=-x;}
	    if(x>9)write(x/10);
	    putchar(x%10+'0');
	}
	inline string readstr(){
		char ch=getchar();string str="";
		while(!(ch>='0'&&ch<='9')&&!(ch>='a'&&ch<='z')&&!(ch>='A'&&ch<='Z')) ch=getchar();
		while((ch>='0'&&ch<='9')||(ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')){str+=ch;ch=getchar();}
		return str;
	}
	inline char readchar(){
		char ch=getchar();
		while(!(ch>='0'&&ch<='9')&&!(ch>='a'&&ch<='z')&&!(ch>='A'&&ch<='Z')) ch=getchar();
		return ch;
	}
}
using namespace quickread;
const int N=2010;
int n,m,A,B;double dis[N];bool vis[N];
struct csp{
	double step;int u;
};
bool operator > (const csp&a,const csp&b){
	return a.step>b.step;
}
struct edge{
	int v;double w;
}
vector<edge> pic[N];
void dijkstra(int u){
	for(int i=1;i<=n;i++) dis[i]=2000000.0;
	dis[u]=0;
	priority_queue<csp,vector<csp>,greater<csp> >q;
	q.push(csp{0.0,u});
	while(!q.empty()){
		u=q.top().u;q.pop();
		if(vis[u]) continue;
		vis[u]=1;
		for(edge to:pic[u]){
			int v=to.v;double w=to.w*dis[u];
			if(w<dis[v]){
				dis[v]=w;
				q.push(csp{dis[v],v});
			}
		}
	}
	cout<<dis[B]*100;
}
signed main(){
//	ios::sync_with_stdio(0);
//	cin.tie();cout.tie();
	n=read(),m=read();
	for(int i=1;i<=m;i++){
		int u=read(),v=read(),w=read();
		pic[u].push_back(edge{v,(w*1.0)/100});
		pic[v].push_back(edge{u,(w*1.0)/100});
	}
	A=read(),B=read();
	dijkstra(A);
	return 0;
}

dev_cpp和洛谷ide上都是这个问题

2024/4/4 17:18
加载中...