Codeforces Round #250 (Div. 2), problem: (C) The Child and Toy editorial: http://codeforces.com/blog/entry/12513
Codeforces Round #250 (Div. 2), problem: (C) The Child and Toy solution: http://ideone.com/WAR619
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { int n, m, v[1005], x, y; long long int sum=0; scanf("%d%d", &n, &m); for(int i=0; i<n; i++) scanf("%d", &v[i]); for(int i=0; i<m; i++) { scanf("%d%d", &x, &y); sum+=min(v[x-1], v[y-1]); } printf("%I64d", sum); return 0; }
No comments:
Post a Comment