排序模拟,理清题意即可,注意输出时候总分相同先输出姓名字典序小的
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
# include<bits/stdc++.h>
# include<unordered_map>
# define eps 1e-9
# define fi first
# define se second
# define ll long long
# define int ll
# define x1 sb
# define y1 dsb
# define x2 ssb
# define y2 ddsb
// cout<<fixed<<setprecision(n)
//bool operator<(const Node& x )
using namespace std;
typedef unsigned long long ull;
typedef pair<int,int > PII;
const int mod=998244353;
const int N=2e5+10;
const int Time=86400;
const int X=131;
const int inf=0x3f3f3f3f;
const double PI = 1e-4;
double pai = 3.14159265358979323846;
double e = exp(1);
int T,n,m,k,t,maxn,ans,p;
struct Node{
string name;
int noip;
int sdoi1;
int sdoi2;
int sdoi3;
int sdoi4;
double score;
}a[N];
bool cmp(Node a, Node b){
if(a.score == b.score) return a.name < b.name;
return a.score > b.score;
}
void solve(){
while(cin >> n){
int max1 = 0 , max2 = 0 , max3 = 0 , max4 = 0 , max5 = 0;
for(int i = 0 ; i < n ; i ++ ){
cin >> a[i].name >> a[i].noip >> a[i].sdoi1 >> a[i].sdoi2 >> a[i].sdoi3 >> a[i].sdoi4;
max1 = max(max1,a[i].noip);
max2 = max(max2,a[i].sdoi1);
max3 = max(max3,a[i].sdoi2);
max4 = max(max4,a[i].sdoi3);
max5 = max(max5,a[i].sdoi4);
}
for(int i = 0 ; i < n ; i ++ ){
a[i].score = a[i].noip * 600 * 1.0 / max1 * 0.25 + (a[i].sdoi1 * 300 * 1.0 /max2 + a[i].sdoi2 * 300 * 1.0/max3)*0.25 + (a[i].sdoi3 * 300 * 1.0 /max4 + a[i].sdoi4 * 300 * 1.0/max5)*0.5;
}
sort(a,a+n,cmp);
for(int i = 0 ; i < n ; i ++ ) cout<<a[i].name<<" "<<fixed<<setprecision(5)<<a[i].score<<"\n";
}
}
/*
1 10 20 20 30
*/
signed main(){
std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//cin >> T;
T = 1;
while(T--){
solve();
}
return 0;
}