Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水过#include<iostream> #include<string.h> using namespace std; int main() { int m,n; char kk[1000][100]; scanf("%d %d",&m,&n); struct test { char key[50]; int num; }t[1000]; for(int i=0;i<m;i++) scanf("%s %d",t[i].key,&t[i].num); while(n--) { int total=0,r=0; while(1) { scanf("%s",kk[r++]); if(strcmp(kk[r-1],".")==0) { printf("%d\n",total); break; } else for(int i=0;i<m;i++) if(strcmp(kk[r-1],t[i].key)==0) total+=t[i].num; } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator