标签:stream false cout vector code scan std nod mmap
#include<iostream> #include<string> #include<algorithm> #include<map> #include<vector> using namespace std; class node{ public: string id; int p, m, f, g; bool flag; node(){p=m=f=g=-1; flag=false;} }; bool cmp(node a, node b){ if(a.g != b.g) return a.g > b.g; return a.id < b.id; } int main(){ int p, m, n, i; cin>>p>>m>>n; string id; int cnt=1, score; vector<node> v(10010); map<string, int> mmap; for(i=0; i<p; i++){ cin>>id; scanf("%d", &score); v[cnt].id=id; v[cnt].p=score; if(score<200) continue; mmap[id]=cnt++; } int index; for(i=0; i<m; i++){ cin>>id; scanf("%d", &score); index=mmap[id]; if(index!=0) v[index].m=score; } for(i=0; i<n; i++){ cin>>id; scanf("%d", &score); if(score<60) continue; index=mmap[id]; if(index!=0){ v[index].f = score; v[index].g = score; if(v[index].m>v[index].f) v[index].g=(int)(0.4*v[index].m+0.6*score+0.5); if(v[index].f>=60 && v[index].p>=200) v[index].flag=true; } } sort(v.begin(), v.begin()+cnt, cmp); for(i=0; i<cnt; i++){ if(v[i].flag){ cout<<v[i].id<<" "; printf("%d %d %d %d\n", v[i].p, v[i].m, v[i].f, v[i].g); } } return 0; }
标签:stream false cout vector code scan std nod mmap
原文地址:https://www.cnblogs.com/mr-stn/p/9168823.html