题目链接
不要因为英文题目而怂了,其实这道题极其简单!

#include<bits/stdc++.h>
using namespace std;
int main(){
	int P,T,G1,G2,G3,GJ;
	double ans=0; 
	while(cin>>P>>T>>G1>>G2>>G3>>GJ){
		if(abs(G1 - G2) <= T){
			ans =(G1 + G2) / 2.0; 
		}else{
			if(abs(G3 - G1) <=T && abs(G3 - G2) <= T){
				ans = max(max(G1, G2), G3);
			}else if(abs(G3 - G1) > T && abs(G3 - G2) > T){
				ans = GJ;
			}else{
				int t = abs(G3 - G1) < abs(G3 - G2)? G1:G2;
				ans= (G3 + t) / 2.0;
			}
		}
		printf("%.1f\n",ans); 
	}
	return 0;
}