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 maxn = 1e7+1;
bool prim[10000001];
vector<int> primek;
int szamol(int a, int p){
int r = 0;
for(int i = p; i <= a; i *= p){
r += a/i;
}
return r;
}
void solve(){
int a, b, c, d; cin>>a>>b>>c>>d;
for(int p : primek){
if(szamol(d, p)-szamol(c-1, p) < szamol(b, p)-szamol(a-1, p)){
cout<<"NE\n";
return;
}
}
cout<<"DA\n"<<endl;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
for(int i = 2; i * i <= maxn; i++){
if(!prim[i]){
primek.push_back(i);
for(int j = i*i; j <= maxn; j+=i){
prim[j] = 1;
}
}
}
int t; cin>>t;
while(t--)solve();
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... |