Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a, b, k;
- cin >> a >> b >> k;
- int zbir = 0;
- for(int n = a; n <= b; n += 1) {
- int broj_na_deliteli_na_n = 0;
- for(int i = 1; i <= n; i += 1) {
- if(n % i == 0) {
- broj_na_deliteli_na_n += 1;
- }
- }
- int ok = 1;
- for(int i = n - 1; i >= n - k; i -= 1) {
- int broj_na_deliteli = 0;
- for(int j = 1; j <= i; j += 1) {
- if(i % j == 0) {
- broj_na_deliteli += 1;
- }
- }
- if(broj_na_deliteli_na_n <= broj_na_deliteli) {
- ok = 0;
- }
- }
- if(ok == 1) {
- zbir += n;
- }
- }
- cout << zbir << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement