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
long long t, a, b, c, d, s, s1;
vector<int> prime;
int calc(int u,int v)
{
int k = 0;
while (u) {
k += u/v;
u /= v;
}
return k;
}
signed main()
{
for(int i = 2; i <= 1000000; ++i)
{
bool check = 0;
for(int j = 2; j * j <= i; ++j)
{
if(i % j == 0)
{
check = 1;
break;
}
}
if(!check) prime.push_back(i);
}
cin >> t;
while(t--)
{
cin >> a >> b >> c >> d;
bool check = 0;
for (int u : prime)
{
if (calc(b, u) - calc(a - 1, u) > calc(d, u) - calc(c - 1, u))
{
check = true;
break;
}
}
if(!check) cout << "DA\n";
else cout << "NE\n";
}
}
# | 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... |