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;
#define int long long
const int maxn = 1e7+1;
bool prim[maxn];
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";
}
main(){
ios_base::sync_with_stdio(0); cin.tie(0);
for(int i = 2; 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;
}
Compilation message (stderr)
Main.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
31 | main(){
| ^~~~
# | 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... |