zoj 2321 Filling Out the Team

原创 2012年03月31日 12:39:58
//没有仔细的阅读题目,以致在比较的时候漏掉了等于的情况!
#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;
		}
	}
}

2321_Filling Out the Team(比大小题,每次输出最后不得有空格)

Over the years, the people of the great city of Pittsburgh have repeatedly demonstrated a collective...

POJ 2070 Filling Out the Team(我的水题之路——double比较)

Filling Out the Team Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 83...

ZOJ-3933-Team Formation【二分图最佳匹配】【KM】

3933-Team Formation

ZOJ 题目3870 Team Formation(数学,位运算)

Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programmi...

ZOJ 1948 POJ 2259 Team Queue

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1948 题目大意: 在组队队列中,每个元素(eleme...

ZOJ 3870 Team Formation

题目链接 Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming program...

ZOJ 3870 Team Formation(数学)

Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming program...

ZOJ-3870 Team Formation(位运算)

Team Formation Time Limit: 2 Seconds      Memory Limit: 131072 KB For an upcoming programming ...

【ZOJ3933 The 16th Zhejiang University Programming ContestG】【费用流】Team Formation 最多组队条件下女

Team Formation Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge For an u...

ZOJ3870:Team Formation(浙江省赛2015)

The 12th Zhejiang Provincial Collegiate Programming Contest  For an upcoming programming contest, ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:zoj 2321 Filling Out the Team
举报原因:
原因补充:

(最多只允许输入30个字)