//没有仔细的阅读题目,以致在比较的时候漏掉了等于的情况!
#include "iostream"
#include "string"
#include "vector"
using namespace std;
struct Info
{
string pos;
double speed;
int weight;
int strength;
};
int main()
{
int weight, strength, i, size;
double speed;
vector<Info> v;
vector<Info> ans;
Info info[3];
info[0].pos = "Wide Receiver", info[0].speed = 4.5, info[0].weight = 150, info[0].strength = 200;
v.push_back(info[0]);
info[1].pos = "Lineman", info[1].speed = 6.0, info[1].weight = 300, info[1].strength = 500;
v.push_back(info[1]);
info[2].pos = "Quarterback", info[2].speed = 5.0, info[2].weight = 200, info[2].strength = 300;
v.push_back(info[2]);
while (cin >> speed >> weight >> strength && speed && weight && strength)
{
ans.clear();
for (i = 0; i < 3; i++)
{
if (v[i].speed >= speed && v[i].weight <= weight && v[i].strength <= strength)
ans.push_back(v[i]);
}
size = ans.size();
if (size == 0)
cout << "No positions" << endl;
else
{
for (i = 0; i < size; i++)
{
if (i != 0)
cout << " ";
cout << ans[i].pos;
}
cout << endl;
}
}
}
zoj 2321 Filling Out the Team
最新推荐文章于 2019-09-23 21:39:10 发布