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