Sum of Counts
Time limit1sMemory limit1024 MB
Given n and m, find the sum of f(n, m, i) over i from 0 to n+m, where f counts pairs (x, y) with x+y=i in the box 0 to n by 0 to m.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
For integers , let be the number of integer ordered pairs that satisfy , , and .
For example, the integer ordered pairs satisfying , , and are , three in total. So .
Given positive integers , find
For example, when , we have . Therefore the answer is .
Input
The first line contains positive integers separated by a space. ()
Output
Print the answer to the problem on the first line.