Filling Out the Team
POJ - 2070
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
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.
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
< speed > < weight > < strength >
Each number will be a real-valued number. The file will end with a line reading "0 0 0"
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 0Sample Output
Wide Receiver Lineman Wide Receiver Quarterback No positions题解:
#include <queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<cmath>
#define mi 0.00000001
using namespace std;
int main()
{
float spe;
int w, s;
while(~scanf("%f%d%d", &spe, &w, &s)&& spe*w*s!=0)
{
int flag = 0;
if(spe<=4.5&&w>=150&&s>=200)
{
flag = 1;
printf("Wide Receiver");
}
if(spe<=6.0&&w>=300&&s>=500)
{
if(flag)
{
printf(" Lineman");
}
else
{
flag = 1;
printf("Lineman");
}
}
if(spe<=5.0&&w>=200&&s>=300)
{
if(flag)
{
printf(" Quarterback");
}
else
{
flag = 1;
printf("Quarterback");
}
}
if(flag)
{
printf("\n");
}
else
{
printf("No positions\n");
}
}
return 0;
}