标签:des style blog http java color
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 738 Accepted Submission(s): 260
1 /*====================================================================== 2 * Author : kevin 3 * Filename : 项目管理.cpp 4 * Creat time : 2014-07-20 19:58 5 * Description : 6 ========================================================================*/ 7 #include <iostream> 8 #include <algorithm> 9 #include <cstdio> 10 #include <cstring> 11 #include <queue> 12 #include <cmath> 13 #define clr(a,b) memset(a,b,sizeof(a)) 14 #define M 100005 15 using namespace std; 16 vector<int>vec[M]; 17 int cnt[M]; 18 int main(int argc,char *argv[]) 19 { 20 int t; 21 scanf("%d",&t); 22 while(t--){ 23 int n,m; 24 clr(cnt,0); 25 scanf("%d%d",&n,&m); 26 int a,b; 27 for(int i = 0; i < m; i++){ 28 scanf("%d%d",&a,&b); 29 vec[a].push_back(b); 30 vec[b].push_back(a); 31 } 32 int tt,ln,u,v; 33 scanf("%d",&tt); 34 for(int i = 0; i < tt; i++){ 35 scanf("%d",&ln); 36 if(ln == 0){ 37 scanf("%d%d",&u,&v); 38 cnt[u] += v; 39 } 40 if(ln == 1){ 41 scanf("%d",&u); 42 int len = vec[u].size(); 43 int sum = 0; 44 for(int i = 0; i < len; i++){ 45 sum += cnt[vec[u][i]]; 46 } 47 printf("%d\n",sum); 48 } 49 } 50 for(int i = 0; i < M; i++) 51 vec[i].clear(); 52 } 53 return 0; 54 }
BestCoder Round #1 1002 项目管理 (HDU 4858),布布扣,bubuko.com
BestCoder Round #1 1002 项目管理 (HDU 4858)
标签:des style blog http java color
原文地址:http://www.cnblogs.com/ubuntu-kevin/p/3860674.html