Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:做wa了……wrong answer 求大神们看下错哪儿了

Posted by WonderMouse at 2015-08-23 02:48:56 on Problem 1258
In Reply To:做wa了……wrong answer 求大神们看下错哪儿了 Posted by:xunyicao_garden at 2014-07-30 14:20:20
> #include<algorithm>
> #include<cstdlib>
> #include<cstdio>
> #include<cstring>
> #include<cmath>
> #include<iostream>
> #include<map>
> #include<queue>
> #include<stack>
> #include<string>
> #include<set>
> #include<utility>
> #include<vector>
> using namespace std;
> int n;
> int a[111][111];
> bool vis[111];
> int ans;
> vector<int> v;   
> int main(){
>     cin>>n;
>     for (int i=1;i<=n;i++)
>     for (int j=1;j<=n;j++)
>     cin>>a[i][j];
>     vis[1]=1;
>     v.push_back(1);
>     for (int i=1;i<=n-1;i++)
>     {    int mn=10000000,tt;
>         for (int j=0;j<v.size();j++)
>         for (int k=1;k<=n;k++)
>         if (a[v[j]][k]&&a[v[j]][k]<mn&&!vis[k]) mn=a[v[j]][k],tt=k;
>         vis[tt]=1;
>         if (tt) ans+=mn;
>         v.push_back(tt);
>     }  
>     cout<<ans;
>     return 0;
> }    

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator