1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| #include <bits/stdc++.h>
using namespace std;
struct haohan { double sum; double zy; double dy; double wy; char name[21]; }p[1010];
int cmp(haohan p1, haohan p2) { return p1.sum>p2.sum; }
int main() { int t,n; double a,b,c; cin>>t; for(int i=0;i<t;i++) { cin>>n>>a>>b>>c; for(int j=0;j<n;j++) { cin>>p[j].name>>p[j].zy>>p[j].dy>>p[j].wy; p[j].zy*=b/100; p[j].dy*=a/100; p[j].wy*=c/100; p[j].sum=p[j].zy+p[j].dy+p[j].wy; } sort(p,p+n,cmp); printf("Case #%d:\n",i+1); for(int j=0;j<n;j++) { printf("%s %.4lf %.4lf %.4lf %.4lf\n",p[j].name,p[j].sum,p[j].zy,p[j].dy,p[j].wy); } } return 0; }
|