Problem:

https://codeforces.com/problemset/problem/909/B

How is this solution actually working for this problem?

In short:

cin>>n;

for(int i=1;i<=n;i++){

res+=min(i,n-i+1);

}

cout<<res<<endl;

Solution:

https://codeforces.com/contest/909/submission/88639922