分析:
这里写代码片
#include<cstdio>
#include<cstring>
#include<iostream>
#define ll long long
using namespace std;
const int N=100001;
int n,tou,wei,deep[N];
ll A,B,C,D;
int doit()
{
ll up,down;
up=A+(n-1)*D;
down=A+(n-1)*C;
for (int i=1;i<=n;i++)
{
if (B<=up&&B>=down) return 1;
up-=(C+D);
down-=(C+D);
}
return 0;
}
int main()
{
//freopen("xiao.in","r",stdin);
//freopen("xiao.out","w",stdout);
int T;
scanf("%d",&T);
while (T--)
{
scanf("%d%lld%lld%lld%lld",&n,&A,&B,&C,&D);
if (doit()) printf("YES
");
else printf("NO
");
}
return 0;
}