Time Limit: 2 Seconds      Memory Limit: 65536 KB

Over the years, the people of the great city of Pittsburgh have repeatedly demonstrated a collective expertise at football second to none. Recently a spy has discovered the true source of the city's football power-a wizard known only as "Myron," who is infallible at selecting the proper position at which each player will excel.

Now that you know the source of Pittsburgh's wisdom, you are determined to provide your school's football team with a computer program that matches the wisdom of "Myron." You have consulted with the best football minds you can find, and they have dispensed their wisdom on the slowest speed, minimum weight, and minimum strength required to play each position.

Position

Slow.Speed

Min.Weight

Min.Strength

Wide Receiver

4.5

150

200

Lineman

6.0

300

500

Quarterback

5.0

200

300

Using this knowledge, you will develop a program that reads in several players physical attributes and outputs what position(s) they are able to play.

 

Input

Each line of the input file will list the attributes for one player:

<speed> <weight> <strength>

Each number will be a real-valued number. The file will end with a line reading "0 0 0".

 

Output

For each player, you will output one line listing the positions that player can play. A player can play a position if each of their attributes is greater or equal to the minimum for weight and strength, and less than or equal to the slowest speed. If a player can play multiple positions, output them in the order listed above, separated by whitespace. You can not leave an extra space at the end of the line. If a player can play no positions, write "No positions" on the line.

 

Sample Input

4.4 180 200
5.5 350 700
4.4 205 350
5.2 210 500
0 0 0

 

Sample Output

Wide Receiver
Lineman
Wide Receiver Quarterback
No positions

Source: Mid-Atlantic USA 2004

 

#include<iostream>

#include<map>

#include<string>

 

using
namespace
std;

 

class
Position

{

private:

    string
name;

    double
lowestSpeed;

    double
minWeight;

    double
minStrength;

public:

    Position(){}

 

    string
GetName()

    {

        return
this->name;

    }

    Position(string
name,
double
lowestSpeed,
double
minWeight,
double
minStrength)

    {

        this->name=name;

        this->lowestSpeed
=
lowestSpeed;

        this->minWeight
=
minWeight;

        this->minStrength
=
minStrength;

    }

 

    bool
MathPosition(double
speed,
double
weight,
double
strength)

    {

        return
(weight
>=
this->minWeight
&&
strength
>=
this->minStrength
&&
speed
<=
this->lowestSpeed);

    }

};

int
main()

{

    Position
**p
=
new
Position*[3];

 

    *p
=
new
Position("Wide Receiver",
4.5,
150,
200);

    *(p+1)
=
new
Position("Lineman",
6.0,
300,
500);

    *(p+2)
=
new
Position("Quarterback",
5.0,
200,
300);

 

    double
s,
w,
str;

    while(cin>>s>>w>>str
&&
(s
!=
0
||
w
!=
0
||
str
!=
0))

    {

        int
matchCount
=
0;

        if((*p)->MathPosition(s,w,str)){

            cout<<(*p)->GetName();

            matchCount++;

        }

        if((*(p+1))->MathPosition(s,w,str)){

            if(matchCount
!=
0)

                cout<<" ";

            cout<<(*(p+1))->GetName();

            matchCount++;

        }

        if((*(p+2))->MathPosition(s,w,str)){

            if(matchCount
!=
0)

                cout<<" ";

            cout<<(*(p+2))->GetName();

            matchCount++;

        }

        if(matchCount
==
0)

            cout<<"No positions";

        cout<<endl;

    }

 

    

    delete[]
p;

    p
=
NULL;

 

    return
0;

}

ZOJ Problem Set – 2321 Filling Out the Team的更多相关文章

  1. ZOJ Problem Set - 1394 Polar Explorer

    这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...

  2. ZOJ Problem Set - 1025解题报告

    ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...

  3. ZOJ Problem Set - 3829Known Notation(贪心)

    ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...

  4. ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】

    称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...

  5. ZOJ Problem Set - 3593 拓展欧几里得 数学

    ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...

  6. ZOJ Problem Set - 2297 Survival 【状压dp】

    题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...

  7. ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】

    题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...

  8. ZOJ Problem Set - 3229 Shoot the Bullet 【有上下界网络流+流量输出】

    题目:problemId=3442" target="_blank">ZOJ Problem Set - 3229 Shoot the Bullet 分类:有源有汇 ...

  9. ZOJ Problem Set - 3822Domination(DP)

    ZOJ Problem Set - 3822Domination(DP) problemCode=3822">题目链接 题目大意: 给你一个n * m的棋盘,每天都在棋盘上面放一颗棋子 ...

随机推荐

  1. OPENERP 拓展 res.partner 对象,添加QQ号

    公司最近在导入开业物品资料,根据同事的需求,需要在供应商资料中添加QQ号一项,根据前段时间自己摸索的经验,准备自己尝试通过继承完成这一需求. 模块名定义为rainsoft_partner 创建__in ...

  2. 静态代理,动态代理,Cglib代理详解

    一.静态代理 新建一个接口 定义一个玩家方法: package com."".proxy.staticc; public interface Iplayer { public vo ...

  3. c++ 网络编程(十一) LINUX下 初步制作基于HTTP的WEB服务器

    原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/9663028.html HTTP概要 理解Web服务器端: 编写HTTP(超文本传输协议)服务器 ...

  4. git push.default 几种设置笔记

    1 simple ,本地和远程分支同名才会推送,只会推送当前的分支到远程 ,默认推送分支数量:1 2 matching , 会推送匹配的本地分之到远程分之,假如本地有的分支远程没有,不会把本地推送到远 ...

  5. logstash 启动报找不主类或无法加载 java

    logstash 启动报无法找到主类解决方案 Zparkle 关注 2018.03.08 22:04* 字数 2051 阅读 1评论 0喜欢 0 当logstash启动时,首先要注意正确配置java ...

  6. linux 下vim的使用(必看)

    vi与vimvi编辑器是所有Unix及Linux系统下标准的编辑器,他就相当于windows系统中的记事本一样,它的强大不逊色于任何最新的文本编辑器.他是我们使用Linux系统不能缺少的工具.由于对U ...

  7. SQL Server 两个时间段的差and时间截取到时分

    /*--------------------------时间截取到时分-----------------------------------*/ ), ),)--返回2017-11-24 19:25 ...

  8. PL/SQL之异常

    异常分为预定义异常和用户自定义异常.预定义异常是由系统定义的异常.由于他们已在STANDARD包中预定义了,因此,这些预定义异常可以直接在程序中使用,而不用在预定义部分声明.而用户自定义异常则需要在定 ...

  9. Hadoop学习笔记(9) ——源码初窥

    Hadoop学习笔记(9) ——源码初窥 之前我们把Hadoop算是入了门,下载的源码,写了HelloWorld,简要分析了其编程要点,然后也编了个较复杂的示例.接下来其实就有两条路可走了,一条是继续 ...

  10. java实现邮箱验证的功能

    在日常生活中,我们在一个网站中注册一个账户时,往往在提交个人信息后,网站还要我们通过手机或邮件来验证,邮件的话大概会是下面这个样子的: 用户通过点击链接从而完成注册,然后才能登录. 也许你会想,为什么 ...