标签:es2017 class string stream click ace map algorithm 技术
对于一条边 想要价值最小 肯定是删点权最大的点
1 #include <cmath> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <iostream> 5 #include <algorithm> 6 #include <map> 7 #include <vector> 8 #include <string> 9 #include <cstring> 10 using namespace std; 11 int a[100005]; 12 long long ans; 13 int main() 14 { 15 freopen("god.in","r",stdin); 16 freopen("god.out","w",stdout); 17 int n,m,A,B,i; 18 scanf("%d%d",&n,&m); 19 for (i=1; i<=n; i++) scanf("%d",&a[i]); 20 while (m--) 21 { 22 scanf("%d%d",&A,&B); 23 ans+=min(a[A],a[B]); 24 } 25 cout<<ans; 26 return 0; 27 }
标签:es2017 class string stream click ace map algorithm 技术
原文地址:http://www.cnblogs.com/whistle13326/p/7662783.html