Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if(n == 1) {
cout << 1 << endl;
} else if(n % 2 == 0) {
cout << n - (n / 2 - 1) << endl;
} else {
cout << n - (n / 2) << endl;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
7
Output
4
Demonstration
Codeforces Solution-A. Splits-Solution in C, C++, Java, Python