Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
33771 黄子涵 书的价格 C++ Accepted 1 MS 860 KB 445 2022-07-30 12:09:40

Tests(4/4):


Code:

#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; }