Edges and More Edges

Time Limit
1s
Memory Limit
65536KB
Judge Program
Standard
Ratio(Solve/Submit)
0.00%(0/0)
Description:

What is the maximum number of edges in an undirected graph G of n vertices that avoids a k-matching? Note that loops and parallel edges are not allowed in the graph.

Input:

The input contains several test cases.
For each test case, there is one line with two positive integers, n ≤ 1000 and k ≤ 1000.
The input ends with two zeroes.

Output:

For each test case output the maximum number of edges.

Sample Input:
1000 1
500 2
0 0
Sample Output:
0
499

Submit