PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PCBSAU0000011. Số cái bắt tay (Handshake Count)
HỌC THEO LỘ TRÌNH
2 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số cái bắt tay (Handshake Count)
Handshake Count
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given people, every unordered pair of distinct people shakes hands exactly once. Count the total handshakes.
Input
One line containing integer .
Output
Print the number of unordered pairs of distinct people.
Subtask
- Subtask 1 — 100 points: .
Example
Input
4
Output
6
Explanation
For , each of the six unordered pairs shakes hands once. The formula gives the output 6.