Run ID:117776
提交时间:2025-04-20 12:07:56
#include<bits/stdc++.h> using namespace std; struct book{ string name; double money; }; bool cmp(book a,book b){ return a.money>b.money; } struct book a[10]; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin.get(); getline(cin,a[i].name); cin>>a[i].money; } sort(a+0,a+n,cmp); printf("%.2lf",a[0].money*1.0); cout<<","<<a[0].name<<endl; printf("%.2lf",a[n-1].money*1.0); cout<<","<<a[n-1].name<<endl; return 0; }