Back
Close

The Dinner

Statement

 Goal

When you go out to dinner with your friends, everyone toasts with everyone else once. You wonder how often one glass bumps into another.
Input
An integer n indicating the number of guests
Output
An integer that indicates the number of times the glasses have been knocked together
Constraints
0 ≤ n ≤ 1000
Example
Input
2
Output
1

Game modes
Fastest, Shortest

Test cases
2 Friends Test
Input
2
Output
1

3 Friends Validator
Input
3
Output
3

5 Friends Test
Input
5
Output
10

20 Friends Validator
Input
20
Output
190

10 Friends Test
Input
10
Output
45

17 Friends Validator
Input
17
Output
136

A very big group - 100 Friends!!! Test
Input
100
Output
4950

11 Friends Validator
Input
11
Output
55

Solution language

Solution

Stub generator input