codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

124A.md (883B)


      1 Source: https://codeforces.com/problemset/problem/124/A
      2 
      3 A. The number of positions
      4 
      5 time limit per test
      6 
      7 0.5 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Petr stands in line of *n* people, but he doesn't know exactly which position he occupies. He can say that there are no less than *a* people standing in front of him and no more than *b* people standing behind him. Find the number of different positions Petr can occupy.
     22 
     23 Input
     24 
     25 The only line contains three integers *n*, *a* and *b* (0 ≤ *a*, *b* < *n* ≤ 100).
     26 
     27 Output
     28 
     29 Print the single number — the number of the sought positions.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 3 1 1
     37 ```
     38 
     39 Output
     40 
     41 ```
     42 2
     43 ```
     44 
     45 Input
     46 
     47 ```
     48 5 2 3
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 3
     55 ```
     56 
     57 Note
     58 
     59 The possible positions in the first sample are: 2 and 3 (if we number the positions starting with 1).
     60 
     61 In the second sample they are 3, 4 and 5.