#P3712. Edges and More Edges

    ID: 2721 远端评测题 1000ms 64MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>POJ Founder Monthly Contest – 2008.12.28, Dagger

Edges and More Edges

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.

1000 1
500 2
0 0
0
499

Source

POJ Founder Monthly Contest – 2008.12.28, Dagger