#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 <= 100000; ++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";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
412 KB |
Output is correct |
2 |
Correct |
17 ms |
512 KB |
Output is correct |
3 |
Correct |
16 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
420 KB |
Output is correct |
2 |
Correct |
16 ms |
416 KB |
Output is correct |
3 |
Correct |
16 ms |
400 KB |
Output is correct |
4 |
Correct |
17 ms |
468 KB |
Output is correct |
5 |
Correct |
16 ms |
416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
468 KB |
Output is correct |
2 |
Correct |
16 ms |
468 KB |
Output is correct |
3 |
Correct |
16 ms |
468 KB |
Output is correct |
4 |
Correct |
17 ms |
416 KB |
Output is correct |
5 |
Correct |
17 ms |
392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
420 KB |
Output is correct |
2 |
Correct |
18 ms |
468 KB |
Output is correct |
3 |
Correct |
16 ms |
468 KB |
Output is correct |
4 |
Correct |
17 ms |
468 KB |
Output is correct |
5 |
Correct |
18 ms |
508 KB |
Output is correct |
6 |
Correct |
17 ms |
504 KB |
Output is correct |
7 |
Incorrect |
18 ms |
412 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
420 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |