题目:https://codeforces.com/problemset/problem/1341/A
思路:判断两个集合是否有交集
做题过程中犯的错误是只考虑了一种情况。。
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n,a,b,c,d;
cin >> n >> a >> b >> c >> d;
int l = (a-b)*n,r = (a+b)*n;
if(l > c+d || r < c-d)
cout << "NO" << endl;
else
cout <<"YES" << endl;
}
system("pause");
return 0;
}