The problem is from codeforces: http://www.codeforces.com/problemset/problem/124/A

Simply a math problem, however, using brute-force will pass the tests since the tests are weak (all numbers are smaller than 100)
s = raw_input().split(" ")
n = int(s[0])
a = int(s[1])
b = int(s[2])
ans = 0
for i in range(1, n + 1):
if i - 1 >= a and n - i<= b:
ans += 1
print ans
If the inputs are considerable large, esepecially if the difference between a and b is large. The above solution will tiime out, because it is brute-force. For a better solution, you might considering to count the number on a single solution line. For example,
|…a….| … | … b … | if a + b < n, solution === > b + 1
|………a…..|…………| if a + b > n, solution === > n – a
|………|……….b…….| if a + b > n
So, a faster python solution is ready.
s = raw_input().split(" ")
n = int(s[0])
a = int(s[1])
b = int(s[2])
print b + 1 if a + b < n else n - a
–EOF (The Ultimate Computing & Technology Blog) —
243 wordsLast Post: Codeforces: A. Rock-Paper-Scissors
Next Post: Notes on Python Syntax