codeforces A. Nastya and Rice
程序员文章站
2022-06-08 16:26:18
...
题目
题意:
对于每一个样例,是否满足
思路:
我们把算出来,然后和进行对比,看看是否相加,不相交的情况是和,排除这两种就是其他的都是。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <deque>
#include <stack>
using namespace std;
typedef long long ll;
typedef vector<int> veci;
typedef vector<ll> vecl;
typedef pair<int, int> pii;
template <class T>
inline void read(T &ret) {
char c;
int sgn;
if (c = getchar(), c == EOF) return ;
while (c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1:1;
ret = (c == '-') ? 0:(c - '0');
while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
ret *= sgn;
return ;
}
inline void out(int x) {
if (x > 9) out(x / 10);
putchar(x % 10 + '0');
}
int main() {
int t;
read(t);
while (t--) {
int n, a, b, c, d;
read(n), read(a), read(b), read(c), read(d);
int x = (a - b) * n;
int y = (a + b) * n;
int xx = (c - d);
int yy = c + d;
if (x > yy) {
printf("No\n");
continue;
} else if (xx > y) {
printf("No\n");
continue;
}
printf("Yes\n");
}
return 0;
}
推荐阅读
-
Codeforces Round #655 (Div. 2) A. Omkar and Completion
-
Codeforces Round #659 (Div. 2) A. Common Prefixes(字符串,思维)
-
Codeforces Round #686 (Div. 3) A. Special Permutation
-
Codeforces A. Sign Flipping (思维 / 构造) (Global Round 9)
-
codeforces A. Sum of Odd Integers
-
A. Add Odd or Subtract Even(思维题) Codeforces Round #624 (Div. 3)
-
Codeforces 1327 A. Sum of Odd Integers
-
codeforces A. Odd Selection
-
【Codeforces Global Round 7】A. Bad Ugly Numbers 题解
-
Codeforces Global Round 7 A. Bad Ugly Numbers