| ||||||||||
| 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>
using namespace std;
struct word
{
int date;
string a;
}w[10000];
int main ()
{
int m,n,i;
cin>>m>>n;
for (i=0;i<m;i++)
cin>>w[i].a >>w[i].date;
while (n--)
{
string ch,c;
int sum=0;
c=".";
while (cin>>ch && ch!=c)
{
for (i=0;i<m;i++)
if (ch==w[i].a ) sum += w[i].date;
}
cout<<sum<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator