码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 2070 Filling Out the Team

时间:2015-06-03 13:11:17      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:

Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 9679   Accepted: 5420

Description

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.
技术分享

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

CODE:
#include <iostream>
#include <cstdio>
#include <cstring>
#define REP(i, s, n) for(int i = s; i <= n; i ++)
#define REP_(i, s, n) for(int i = n; i >= s; i --)

using namespace std;

double spd;
int wgt, str;

int main(){
    while(scanf("%lf%d%d", &spd, &wgt, &str) != EOF){
        if(spd == 0 && wgt == 0 && str == 0) break;
        bool tmp = 0;
        if(spd <= 4.5 && wgt >= 150 && str >= 200)
            printf("Wide Receiver "), tmp = 1;
        if(spd <= 6.0 && wgt >= 300 && str >= 500)
            printf("Lineman "), tmp = 1;
        if(spd <= 5.0 && wgt >= 200 && str >= 300)
            printf("Quarterback "), tmp = 1;
        if(!tmp) printf("No positions");
        cout << endl;
    }
    return 0;
}

 


POJ 2070 Filling Out the Team

标签:

原文地址:http://www.cnblogs.com/ALXPCUN/p/4548619.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!