문제
Vera owns N tops and N pants. The i-th top and i-th pants have colour i, for 1 ≤ i ≤ N, where all N colours are different from each other.
An outfit consists of one top and one pants. Vera likes outfits where the top and pants are not the same colour.
How many different outfits does she like?
입력
The input will be in the format:
N |
Constraints:
- 1 ≤ N ≤ 2017
- N is integer
출력
Output one line with the number of different outfits Vera likes.
예제 입력 1
1 |
예제 출력 1
0 |
예제 입력 2
2 |
예제 출력 2
2 |
예제 입력 3
5 |
예제 출력 3
20 |
더보기
Solution
#include<stdio.h>
int main(void)
{
int N;
scanf("%d", &N);
printf("%d\n", N*N-N);
return 0;
}
728x90
'백준 알고리즘' 카테고리의 다른 글
<백준 알고리즘> 17087번: 숨바꼭질 6 (0) | 2020.11.26 |
---|---|
<백준 알고리즘> 16431번: 베시와 데이지 (0) | 2020.11.25 |
<백준 알고리즘> 4766번: 일반 화학 실험 (0) | 2020.11.25 |
<백준 알고리즘> 5613번: 계산기 프로그램 (0) | 2020.11.25 |
<백준 알고리즘> 15873번: 공백 없는 A+B (0) | 2020.11.25 |