Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
33772 | 王逸凡 | 书的价格 | C++ | Accepted | 1 MS | 856 KB | 469 | 2022-07-30 12:09:44 |
#include<iostream> #include<string> #include<iomanip> using namespace std; int main() { int n; cin>>n; getchar(); string s1,s2,tmp; double maxval=0,minval=999999.0,x; while(n--){ getline(cin,tmp); cin>>x; getchar(); if(x>maxval){ maxval=x; s1=tmp; } if(x<minval){ minval=x; s2=tmp; } } cout<<fixed<<setprecision(2)<<maxval<<","<<s1<<endl; cout<<fixed<<setprecision(2)<<minval<<","<<s2<<endl; return 0; }