九度OJ 1002

 #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
    int p,t,g1,g2,g3,gj;
    while(scanf("%d %d %d %d %d %d",&p,&t,&g1,&g2,&g3,&gj)!=EOF)
    {
        if(abs(g1-g2)<=t)
            printf("%.1f\n",(g1+g2+0.0)/2);
        else
        {
            if(abs(g3-g1)>=t && abs(g3-g2)<=t)
            {

                printf("%.1f\n",(g3+g2+0.0)/2);
            }

            else if(abs(g3-g1)<=t && abs(g3-g2)>=t)
            {

                printf("%.1f\n",(g3+g1+0.0)/2);
            }
            else if(abs(g3-g1)<=t && abs(g3-g2)<=t)
                printf("%.1f\n",max(max(g1,g2),g3)+0.0);
            else
                printf("%.1f\n",gj+0.0);
        }
    }
    return 0;
}

 

posted @ 2014-04-11 13:35  JKXQJ  阅读(114)  评论(0编辑  收藏  举报