Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
120916 | 秦炜杰 | 互送礼物 | C++ | 通过 | 100 | 0 MS | 256 KB | 684 | 2024-01-21 11:21:20 |
#include<bits/stdc++.h> using namespace std; struct People{ string name; int give_money; int get_money; }; int main(){ int n; cin>>n; People people[110]={}; for(int i=1;i<=n;i++) cin>>people[i].name; for(int i=1;i<=n;i++){ string s,st; int m,t; cin>>s>>m>>t; if(t==0) continue; for(int j=1;j<=t;j++){ cin>>st; for(int k=1;k<=n;k++){ if(st==people[k].name){ people[k].get_money+=m/t; } } } for(int i=1;i<=n;i++){ if(s==people[i].name){ people[i].give_money+=t*(m/t); } } } for(int i=1;i<=n;i++){ cout<<people[i].name<<" "<<people[i].get_money-people[i].give_money<<endl; } return 0; }