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 <iostream>
#include <vector>
using namespace std;
#define PB push_back
const int maxn = 1e7 + 5;
bool prime[maxn];
vector<int> primes;
inline int szfact (int a, int p){
int ret = 0;
for(int i=p; i<=a; i*=p) {
ret += a/i;
}
return ret;
}
inline void solve() {
int a,b,c,d;
cin >> a >> b >> c >> d;
for(auto p:primes) {
if(szfact(b,p)-szfact(a-1,p)>szfact(d,p)-szfact(c-1,p)) {
cout << "NE\n";
return;
}
}
cout << "DA\n";
}
int main() {
cin.tie(NULL)->sync_with_stdio(false);
int t;
cin >> t;
for(int i=2; i<maxn; i++) {
if(prime[i]) continue;
for(int j=i*2; j<=1e7+1; j+=i) prime[j] = true;
primes.PB(i);
}
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... |