Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // OK Timus 1023
- # include <iostream>
- using namespace std;
- int main() {
- size_t n;
- cin >> n;
- size_t res = n - 1;
- for (size_t i = 3; i * i <= n; i++) {
- if (n % i == 0) {
- res = i - 1;
- break;
- }
- }
- if (n % 2 == 0 && n > 4 && n / 2 < res) {
- cout << n / 2 - 1;
- } else {
- cout << res;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment