반응형
백준: 15439번 Vera and Outfits (Python3)
Vera and Outfits 성공다국어
시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 | 256 MB | 3847 | 3426 | 3286 | 89.245% |
문제
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
답안
1
2
|
N = int(input())
print(N*N-N)
|
cs |
반응형
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 15080번 Every Second Counts (Python3) (0) | 2022.08.06 |
---|---|
백준: 15128번 Congruent Numbers (Python3) (0) | 2022.08.06 |
백준: 15474번 鉛筆 (Pencils) (Python3) (0) | 2022.08.06 |
백준: 15552번 빠른 A+B (Python3) (0) | 2022.08.06 |
백준: 15610번 Abbey Courtyard (Python3) (0) | 2022.08.06 |
댓글