Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <fstream>
- using namespace std;
- int del(int n, int s = 1) {
- if (s <= n) {
- if (n % s == 0) {
- return s + del(n, s + 1);
- }
- else {
- return del(n, s + 1);
- }
- }
- else { return 0; }
- }
- int main() {
- int a, b;
- cin >> a >> b;
- int c = 1;
- for (int i = a; i <= b; i++) {
- c = max(c, del(i));
- }
- for (int i = a; i <= b; i++) {
- if (del(i) == c) {
- cout << i << " ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement