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;
const int N = 1e7 + 5;
int t, a, b, c, d, cnt1, cnt2;
bool isprime[N];
vector<int> primes;
void precalc(){
fill(isprime + 2, isprime + N, true);
for(int i = 2; i * i < N; i++){
if(isprime[i]){
primes.push_back(i);
for(int j = i * i; j < N; j += i) isprime[j] = false;
}
}
}
int findexp(int n, int x){
int cnt = 0;
while(n > 0){
cnt += n / x;
n /= x;
}
return cnt;
}
void solve(){
cin >> a >> b >> c >> d;
for(auto p : primes){
cnt1 = findexp(b, p) - findexp(a - 1, p);
cnt2 = findexp(d, p) - findexp(c - 1, p);
if(cnt1 > cnt2){
cout << "NE\n";
return;
}
}
cout << "DA\n";
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
precalc();
cin >> t;
while(t--){
solve();
}
}
# | 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... |