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;
		}
	}
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

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

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

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 ...

ZOJ3870:Team Formation(浙江省赛2015)

The 12th Zhejiang Provincial Collegiate Programming Contest  For an upcoming programming contest, ...

ZOJ-3870-Team Formation【位运算】【12th浙江省赛】

ZOJ-3870-Team Formation

zoj3870-Team Formation(异或运算)

题目来源 题意:每组n个数字,对于一组中任意两个数A,B满足A ⊕ B > max{A, B},则A,B为满足条件的一对数。求满足条件的总对数。 思路:对于异或,就要用二进制去算。   ...

ZOJ_1462 Team Them Up! 求完连通分量后,再进行背包,之后背包路径回溯

Team Them Up! Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge ...

Zoj 3870 Team Formation(异或运算)

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

ZOJ 3870 Team Formation 第12届浙江省省赛B题 [位运算+思维]【数学】

题目链接 :http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3870Team FormationTime Limit: 3 S...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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