Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157085 付博苏逸 书的价格 C++ Accepted 1 MS 276 KB 481 2026-07-13 15:02:50

Tests(4/4):


Code:

#include<bits/stdc++.h> using namespace std; struct s { string name; double money; }; bool cmp(s a,s b) { if(a.money>b.money) { return 1; } return 0; } int main() { int n,max=-1,min=999999999; cin>>n; s a[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); cout<<","<<a[0].name<<endl; printf("%.2lf",a[n-1].money); cout<<","<<a[n-1].name; return 0; }