Дроби-1
unknown
c_cpp
2 years ago
724 B
11
Indexable
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
bool nat(int i, int j);
int main()
{
float x;
int n;
cin >> x;
cin >> n;
int count = 0;
for (int i = 2; i < n + 1; i++) {
for (int j = 1; j < i; j++) {
if (static_cast<float>(j) / i <= x) {
if (nat(j, i)) {
count++;
}
}
else {
j = i;
}
}
}
cout << count;
}
bool nat(int i, int j) {
if (i % j == 0 && j != 1) return false;
for (int x = 2; x < j + 2; x++) {
if (i % x == 0 && j % x == 0) return false;
}
return true;
}Editor is loading...
Leave a Comment