Run ID:33778

提交时间:2022-07-30 12:09:57

#include <iostream> #include <iomanip> #include <string> using namespace std; int main(){ int n; cin>>n; getchar(); string s1,s2,tmp; double max=0,min=999999.0,x; while(n--){ getline(cin,tmp); cin>>x; getchar(); if(x>max){ max=x; s1=tmp; } if(x<min){ min=x; s2=tmp; } } cout<<fixed<<setprecision(2)<<max<<","<<s1<<endl; cout<<fixed<<setprecision(2)<<min<<","<<s2<<endl; return 0; }