POJ 2070
来源:互联网 发布:程序员能做到多少岁 编辑:程序博客网 时间:2024/06/05 23:43
题意:给出了球场上WideReceiver,Lineman,Quarterback三个位置所需人员的最低属性(speed,weight , strength)要求,输入:三个数据,为别为speed、weight、strength,若输入的速度低于或等于球场上位置的要求,体重和力量大于或等于球场上位置的要求,则输出相应的符合位置,若有多个符合的位置,中间用一个空格隔开输出,如没有符合位置,则输出
No positions。
思路:将输入属性与球场位置的要求属性依次比较即可。
代码:
#include<iostream>
usingnamespace std;
intmain()
{
double pl[3],a[3][3]={{4.5,150,200},{6,300,500},{5,200,300}};
char b[3][15]={"WideReceiver ","Lineman ","Quarterback "};
int flag;
while(cin>>pl[0]>>pl[1]>>pl[2],(pl[0]||pl[1]||pl[2]))
{
flag=0;
for(int i=0;i<3;i++)
if(pl[0]<=a[i][0]&&pl[1]>=a[i][1]&&pl[2]>=a[i][2]){cout<<b[i];flag=1;}
if(flag==1)cout<<endl;
else cout<<"Nopositions"<<endl;
}
return 0;
}
using
int
{
}
- POJ 2070
- poj 2488
- POJ 3299
- poj 1905
- POJ 2485 Highways
- POj 1017 Packets
- poj 1020 搜索
- poj 3278 宽搜
- poj 1426 宽搜
- poj 1925 Spiderman
- poj 3259 Wormholes
- POJ 2160 BOX
- POJ 2190 ISBN
- poj 3299 humidex
- poj 2253 Frogger
- poj 2485 Highways
- poj 3041 Asteroids
- poj 数论 1845
- POJ 1929
- POJ 1969
- POJ 2000
- POJ 2005
- POJ 2017
- POJ 2070
- POJ 1931
- CSharpThinking
- POJ 1976
- 利用new定义二维数组,delete删除…
- POJ 2101
- POJ 2105
- POJ 2109
- POJ 2116