Octopus
Time limit1sMemory limit1024 MB
Starting from N vertices with no edges, find the most vertices that can each have exactly K incident edges in a simple undirected graph.
Problem
Graph starts with vertices and no edges. You may add undirected edges between two distinct vertices any number of times, but you cannot add a duplicate edge. Given , find the maximum number of octopus vertices that can be made by adding edges.
- A vertex in a graph is called an octopus if exactly edges are connected to it.
Input
The first line contains and , separated by a space.
Output
On the first line, print the maximum number of octopus vertices that can be made by adding edges.