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 namespace std;
typedef long long ll;
const int N = 1e7 + 7;
int p[N];
vector<int> primes;
int Calc(int x, int factor){
int res = 0;
while (x >= factor)
res += (x /= factor);
return res;
}
int Calc(int l, int r, int factor){
return Calc(r, factor) - Calc(l - 1, factor);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int i = 2; i < N; i++){
if (p[i])
continue;
primes.push_back(i);
for(int j = i; j < N; j += i)
p[j] = i;
}
int t;
cin >> t;
while (t--){
int a, b, c, d;
cin >> a >> b >> c >> d;
bool stop = 0;
for(int factor : primes)
if (Calc(c, d, factor) < Calc(a, b, factor)){
cout << "NE\n";
stop = 1;
break;
}
if (!stop)
cout << "DA\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... |