Number of different positions where a person can stand | C ++ implementation of above approach ; Function to find the position ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int findPosition ( int n , int f , int b ) { return n - max ( f + 1 , n - b ) + 1 ; } int main ( ) { int n = 5 , f = 2 , b = 3 ; cout << findPosition ( n , f , b ) ; return 0 ; }