Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Edges and More Edges
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 916Accepted: 211

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

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator