[백준, BOJ 15439] Vera and Outfits (python)
Problem Solving/BOJ

[백준, BOJ 15439] Vera and Outfits (python)

728x90

https://www.acmicpc.net/problem/15439

 

15439번: Vera and Outfits

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.

www.acmicpc.net


문제

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.

728x90

 

예제 입력 1

1

예제 출력 1

0

 

예제 입력 2

2

예제 출력 2

2

 

예제 입력 3

5

예제 출력 3

20

# Vera에겐 N개의 상의와 N개의 하의가 있다.
# N개의 상의와 하의는 각각 모두 다른 색이고, 상의와 하의의 색의 구성은 같다.
# 같은 색의 상의와 하의는 입을 수 없을 때, 나올 수 있는 outfit의 개수는?

N = int(input())

print(N * (N -1))
728x90