This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
const int MAX = 10000000;
vector<char> is_prime(MAX + 1, true);
is_prime[0] = is_prime[1] = false;
vector<int> prime;
for (int i = 2; i <= MAX; ++i) {
if (is_prime[i]) {
prime.push_back(i);
for (int j = i + i; j <= MAX; j += i) {
is_prime[j] = false;
}
}
}
const auto count = [&](int x, int p) {
int ret = 0;
while (x > 0) {
ret += x /= p;
}
return ret;
};
int T;
std::cin >> T;
while (T--) {
int a, b, c, d;
std::cin >> a >> b >> c >> d;
a -= 1, c -= 1;
bool f = true;
for (const int p : prime) {
if (count(b, p) - count(a, p) > count(d, p) - count(c, p)) {
f = false;
break;
}
}
std::cout << (f ? "DA" : "NE") << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |