Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:LINK : fatal error LNK1104: cannot open file 'lnk6ACB.tmp'这是什么错误啊In Reply To:LINK : fatal error LNK1104: cannot open file 'lnk6ACB.tmp'这是什么错误啊 Posted by:howling at 2011-08-25 21:08:21 请问这道题哪里不对了 CE了无数次 #include<iostream> #include<string> #include<map> #include<algorithm> #include<stdio> using namespace std; int main (){ map<string,int> my_map; map<string,int>::iterator iter; float mile; int n; int m; float c; float w[101][101]; float dist[101]; bool s[101]; string str1,str2; for(int i=0;i<101;i++){ s[i]=false; for(int j=0;j<101;j++){ w[i][j]=9999.9; } } cin>>mile; cin>>n; for(int i=1;i<=n;i++){ cin>>str1; my_map[str1]=i; } cin>>m; for(int i=0;i<m;i++){ cin>>str1>>str2>>c; iter=my_map.find(str1); int a,b; a=iter->second; iter=my_map.find(str2); b=iter->second; if(w[a][b]>c)w[a][b]=w[b][a]=c; } //init s[1]=true;dist[1]=0; for(int i=2;i<=n;i++){dist[i]=w[1][i];} float len=0.0; //start for(int k=1;k<n;k++){ float min=9999.9; int u; for(int i=2;i<=n;i++){ if(!s[i]&&dist[i]<min){min=dist[i];u=i;} } s[u]=true; len+=min; min=9999.9; for(int i=2;i<=n;i++){ if(!s[i]&&dist[i]>w[u][i])dist[i]=w[u][i]; } } if(len>mile)cout<<"Not enough cable"<<endl; else cout<<"Need "<<len<<" miles of cable"<<endl; system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator