PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Authors: naisheel, jalp1428
Tester: tabr
Editorialist: iceknight1093
DIFFICULTY:
739
PREREQUISITES:
None
PROBLEM:
Chef has 11 players, and needs to designate one of them to be the captain and another to be vice-captain.
He’s narrowed his choices down to N players. How many possibilities are there in total?
EXPLANATION:
One of these N players, one will be the captain and one will be the vice-captain.
There are N choices for who to choose as captain; then Chef is left with N-1 players among whom one will become vice-captain.
For each captain choice, there are N-1 vice-captain choices; and so with N initial choices for captain, the total number of possibilities is N\cdot (N-1).
TIME COMPLEXITY
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
n = int(input())
print(n * (n-1))