POJ 2070 Filling Out the Team

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;
}
				
时间: 2024-11-01 22:17:31

POJ 2070 Filling Out the Team的相关文章

POJ 2070 Filling Out the Team(水题)

[题目简述]:给出了球场上WideReceiver,Lineman,Quarterback三个位置所需人员的最低属性(speed,weight ,strength)要求,输入:三个数据,为别为speed.weight.strength,若输入的速度低于或等于球场上位置的要求,体重和力量大于或等于球场上位置的要求,则输出相应的符合位置,若有多个符合的位置,中间用一个空格隔开输出,如没有符合位置,则输出 No positions. [分析]:很简单,但是,对于我的代码还是有个疑问,就是拿题目中前两个

POJ 2070

#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("acm.acm","r",stdin); double speed; double weight; double strength; int time; while(cin>>speed>>weight>>strength) { time = 0

HOJ 题目分类

转自:http://blog.sina.com.cn/s/blog_65f3869301011a1o.html ******************************************************************************* 简单题(包括枚举,二分查找,(复杂)模拟,基础数据结构(栈.队列),杂题等 ****************************************************************************

HDU 3296 &amp; POJ 3138 Acm Team Section(数学)

题目链接: HDU: http://acm.hdu.edu.cn/showproblem.php?pid=3296 POJ:  http://poj.org/problem?id=3138 Acm Team Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 159    Accepted Submission(s): 47

POJ 3339 &amp; HDU 2409 Team Arrangement(结构体)

题目链接: PKU:http://poj.org/problem?id=3339 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=2409 Description Barry Bennett, the coach of the Bings football team, wants to arrange his team for an important match against the Bangs. He decides on the formati

Poj 1112 Team Them Up!

题意:现在有一群人,告诉你每个人都认识哪些人,让你将这一群人分成两组,其中每一组中的每个人都相互认识,并且使得两组中的人数尽量相近.问你是否能分成这样两组,如果不能输出No Solution ,否则输出人数最相近的方案. 注意你认识我不代表我认识你,组中的每一个人都必须是相互认识的. 首先建立由人和人认识关系构成的有向图,然后将其转化成一张无向图,如果两个点之间的边不是双向的,等于没有,所以就将其删去,保留双向边.然后对这个无向图求一次补图,形成的补图可能有多个联通块,并且位于不同联通块中的点是

【POJ 1112】Team Them Up!(二分图染色+DP)

Description Your task is to divide a number of persons into two teams, in such a way, that: everyone belongs to one of the teams; every team has at least one member; every person in the team knows every other person in his team; teams are as close in

poj 2038 Team Rankings 枚举排列

//poj 2038 //sep9 #include <iostream> #include <algorithm> using namespace std; char s[128][8]; int count(char s1[],char s2[]) { int cnt=0; for(int i=0;i<5;++i) for(int j=i+1;j<5;++j){ int k; for(k=0;k<5;++k) if(s1[i]==s2[k]) break; f

POJ 2259 Team Queue 数据结构 队列

Team Queue Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3282   Accepted: 1188 Description Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, thoug