이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<
#define INF (ll)1e18
#define mod 998244353
#define maxn 10000010
int i, i1, j, k, k1, t, n, m, res, flag[10], a, b, c, d, er[maxn];
vector<int> pr;
int pdc(int a, int p) {
if (a < p) return 0;
return a / p + pdc(a / p, p);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
/* #if !ONLINE_JUDGE && !EVAL
ifstream cin("input.txt");
ofstream cout("output.txt");
#endif */
for (i = 0; i < maxn; i++) er[i] = i;
for (i = 2; i < maxn; i++) {
if (er[i] != i) continue;
for (j = 2 * i; j < maxn; j += i) er[j] = i;
}
for (i = 2; i < maxn; i++) {
if (er[i] == i) pr.pb(i);
}
cin >> t;
while (t--) {
cin >> a >> b >> c >> d; flag[0] = 1;
for (auto u : pr) {
if (pdc(d, u) - pdc(c - 1, u) - pdc(b, u) + pdc(a - 1, u) < 0) flag[0] = 0;
}
if (flag[0] == 1) cout << "DA" << nl;
else cout << "NE" << nl;
}
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... |