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 X first
#define Y second
#define sz(a) (int)a.size()
#define ll long long
const int N = 1e7;
const int T = 20;
signed main()
{
// ifstream cin("input1.txt.4c");
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
vector <bool> pr(N + 1, 1);
for(int i = 2; i <= N; i++)
{
int j = i * 2;
while(j <= N)
{
pr[j] = 0;
j += i;
}
}
while(t--)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
int fl = 1;
for(int j = 2; j <= N; j++)
{
if(pr[j])
{
int k = j;
int s1 = 0, s2 = 0;
while(1)
{
s1 += ((b / k) - ((a - 1) / k));
s2 += ((d / k) - ((c - 1) / k));
if(N / j < k)
{
break;
}
k *= j;
}
if(s2 < s1)
{
fl = 0;
}
}
}
if(fl)
{
cout << "DA\n";
}
else
{
cout << "NE\n";
}
}
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... |