代码如下:
#include
#include
#include
using namespace std;
struct person{
string name;
int age;
int worths;
};
bool cmp(person a,person b){
if(a.worths==b.worths)
{
if(a.age==b.age)return a.nameb.worths;
}
int main()
{
int n,k;
cin>>n>>k;
vector v(n);
for(int i=0;i>name>>age>>worths;
v[i].name=name;
v[i].age=age;
v[i].worths=worths;
}
sort(v.begin(),v.end(),cmp);
for(int i=0;i>maxnum>>amin>>amax;
cout<<"Case #"< temp;
for(int j=0;j=maxnum)break;
if(v[j].age>amax)continue;
if(v[j].age>=amin&&v[j].age<=amax){
cnt++;
temp.push_back(v[j]);
}
}
if(cnt==0)cout<<"None"<
运行结果如下: