记录编号 |
107159 |
评测结果 |
AAAAAAAAA |
题目名称 |
贪婪的送礼者 |
最终得分 |
100 |
用户昵称 |
HouJikan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.002 s |
提交时间 |
2014-06-22 20:15:50 |
内存使用 |
0.32 MiB |
显示代码纯文本
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <ctime>
#include <functional>
#define pritnf printf
typedef long long LL;
typedef unsigned int Uint;
const int INF=0x7ffffff;
using namespace std;
string namelist[11];
map <string,int> receive;
int main()
{
freopen("gift1.in","r",stdin);
freopen("gift1.out","w",stdout);
receive.clear();
int n;
scanf("%d",&n);
string host,guest;
for(int a=1;a<=n;a++)
cin>>namelist[a];
int gnum,money;
for(int a=1;a<=n;a++)
{
cin>>host;
scanf("%d%d",&money,&gnum);
for(int i=1;i<=gnum;i++)
{
cin>>guest;
receive[guest]+=money/gnum;
}
if (gnum!=0)
{
receive[host]=receive[host]-money;
receive[host]=receive[host]+money-money/gnum*gnum;
}
}
for(int i=1;i<=n;i++)
cout<<namelist[i]<<" "<<receive[namelist[i]]<<endl;
return 0;
}