이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e7 + 7;
int p[N];
vector<int> primes;
int Calc(int x, int factor){
int res = 0;
while (x >= factor)
res += (x /= factor);
return res;
}
int Calc(int l, int r, int factor){
return Calc(r, factor) - Calc(l - 1, factor);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int i = 2; i < N; i++){
if (p[i])
continue;
primes.push_back(i);
for(int j = i; j < N; j += i)
p[j] = i;
}
int t;
cin >> t;
while (t--){
int a, b, c, d;
cin >> a >> b >> c >> d;
bool stop = 0;
for(int factor : primes)
if (Calc(c, d, factor) < Calc(a, b, factor)){
cout << "NE\n";
stop = 1;
break;
}
if (!stop)
cout << "DA\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... |