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>
#define int long long
using namespace std;
int count(int n, int p){
int c = 0;
while(n>0){
n /= p;
c += n;
}
return c;
}
int32_t main(){
int t,a,b,c,d;
int maxn = 100000;
cin >> t;
vector<int> prime(maxn,true);
prime[0] = false;
prime[1] = false;
for(int i=2;i<maxn;i++){
if(prime[i]){
for(int j=i*i;j<=maxn;j+=i){
prime[j] = false;
}
}
}
while(t--){
cin >> a >> b >> c >> d;
bool ans = true;
for(int i=2;i<maxn;i++){
if(!prime[i]) continue;
int pr = i;
if(count(b,pr)-count(a-1,pr)>count(d,pr)-count(c-1,pr)){
ans = false;
break;
}
}
if(ans) cout << "DA" << endl;
else cout << "NE" << endl;
}
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... |