天天看點

數字遊戲。

思路:

#include<bits/stdc++.h>
using namespace std;
#define ll long long


int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n;
    cin>>n;
    double maxx,minn,ave;
    cin>>maxx>>minn>>ave;
    if(maxx < minn || ave < minn || ave > maxx)
    {
      cout<<"no"<<endl;
      continue;
    }
    maxx = (n-1)*maxx+minn,maxx/=n;
    minn = (n-1)*minn+maxx,minn/n;
    if(ave >= minn && ave <= maxx)cout<<"yes"<<endl;
  }
}      

繼續閱讀