HDU 1236 ( 排名 )
生活随笔
收集整理的這篇文章主要介紹了
HDU 1236 ( 排名 )
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Problem : 1236 ( 排名 ) Judge Status : Accepted RunId : 5684884 Language : C++ Author : ssun Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta #include<iostream> #include<string> #include<algorithm> using namespace std; struct ST { string id; int all; int prob[12]; ST(){ memset(prob,0,sizeof(prob)); all = 0; } }; int cmp(ST &st1,ST &st2) { if(st1.all!=st2.all) return st1.all>st2.all; return st1.id<st2.id; } int main() { int n,m,g; int i,j; int score[12]; while(scanf("%d",&n),n) { ST st[1010]; scanf("%d%d",&m,&g); int count = 0; memset(score,0,sizeof(score)); for(i=0; i<m; i++) scanf("%d",&score[i]); for(i=0; i<n; i++) { int all; cin>>st[i].id>>all; for(j=0; j<all; j++) { scanf("%d",&st[i].prob[j]); st[i].all += score[st[i].prob[j]-1]; } if(st[i].all>=g) count++; } cout<<count<<endl; sort(st,st+n,cmp); for(i=0; i<n; i++) { if(st[i].all>=g) cout<<st[i].id<<" "<<st[i].all<<endl; } } return 0; }
轉載于:https://www.cnblogs.com/android-html5/archive/2012/04/01/2533903.html
總結
以上是生活随笔為你收集整理的HDU 1236 ( 排名 )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pickle模块介绍
- 下一篇: 软件开发基本原则(一)—— 策略和因素