Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19177 Accepted Submission(s): 7033
题解:水题;
代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<string>
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define PI(x) printf("%d",x)
#define PL(x) printf("%lld",x)
#define P_ printf(" ")
#define T_T while(T--)
typedef long long LL;
int score[15];
int ans;
int G;
struct Node{
char s[25];
int len;
int m[15];
int tot;
Node init(){
tot=0;
int len;
scanf("%s",s);
scanf("%d",&len);
for(int i=0;i<len;i++)
scanf("%d",&m[i]),tot+=score[m[i]];
if(tot>=G)ans++;
}
friend int operator < (Node a,Node b){
if(a.tot!=b.tot)return a.tot>b.tot;
else return strcmp(a.s,b.s)<0;
}
};
Node m[1010];
int main(){
int N,M,len;
while(SI(N),N){
SI(M);SI(G);
for(int i=1;i<=M;i++)SI(score[i]);
ans=0;
for(int i=0;i<N;i++){
m[i].init();
}
sort(m,m+N);
printf("%d\n",ans);
for(int i=0;i<N;i++){
if(m[i].tot>=G)
printf("%s %d\n",m[i].s,m[i].tot);
else break;
}
}
return 0;
}
原文:http://www.cnblogs.com/handsomecui/p/5087042.html