Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
94071 | 赵文浚 | 书的价格 | C++ | Accepted | 1 MS | 272 KB | 622 | 2024-10-19 18:01:51 |
#include<bits/stdc++.h> using namespace std; struct student { string name; double prize; }; student stu[10]; int main() { int n; cin>>n; int max=0,maxid; int min=10000000000,minid; for(int i=1;i<=n;i++) { cin.get(); getline(cin,stu[i].name); cin>>stu[i].prize; } for(int i=1;i<=n;i++) { if(max<stu[i].prize) { max=stu[i].prize; maxid=i; } if(stu[i].prize<min) { min=stu[i].prize; minid=i; } } printf("%.2lf,",stu[maxid].prize); cout<<stu[maxid].name<<endl; printf("%.2lf,",stu[minid].prize); cout<<stu[minid].name<<endl; }