Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=4858
Test instructions: Chinese does not explain
Solution: Directly Press test instructions simulation again, data water?
Code:
#include <stdio.h>#include <iostream>#include <math.h>#include <stdlib.h>#include <ctype.h>#include <algorithm>#include <vector>#include <string>#include <queue>#include <stack>#include <set>#include <map>#include <string.h>using namespace STD;intN, M, q; vector<int>g[100010];inta[100010], B, C, D;intMain () {intTscanf("%d", &t); while(t--) {scanf("%d%d", &n,&m); for(inti =0; I <= N; i++) g[i].clear ();memsetA0,sizeof(a)); while(m--) {scanf("%d%d", &b,&c); G[b].push_back (c); G[c].push_back (b); }scanf("%d", &q); while(q--) {scanf("%d", &b);if(b = =0) {scanf("%d%d", &c, &d); A[C] + = D; }Else{intAns =0;scanf("%d", &c); for(inti =0; I < g[c].size (); i++) ans + = a[g[c][i]];printf("%d\n", ans); } } }return 0;}
Copyright NOTICE: Reprint please indicate the source.
HDU 4858 Project Management