时间:2021-07-01 10:21:17 帮助过:21人阅读
#include#include #include #include #include using namespace std; typedef struct persons { string id; int total; int grade; }persons; bool compare(persons a,persons b) { if (a.grade!=b.grade) return a.grade>b.grade; else return a.id < b.id; } int main() { int N,M,G; vector vec; int grade[11]; while(cin>>N,N!=0) { memset(grade,0,sizeof(grade)); vec.clear(); int ans=0; cin>>M>>G; for (int i=1;i<=M;i++) cin>>grade[i]; for (int i=0;i >p.id>>p.total; p.grade = 0; for (int j=1;j<=p.total;j++) { int t; cin>>t; p.grade += grade[t]; } if (p.grade >= G) ++ans; vec.push_back(p); } sort(vec.begin(),vec.end(),compare); cout<
http://www.bkjia.com/PHPjc/532695.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532695.htmlTechArticle题目描述: 今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑每题的分值,所以并不是最后的排名。...