문제
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.
Solved.ac 레벨
브론즈 IV
풀이
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
cout << n * (n - 1) << "\n";
return 0;
}
'Study (etc) > Problem Solving' 카테고리의 다른 글
[BOJ / C++] 1850번 : 최대공약수 (0) | 2023.04.03 |
---|---|
[BOJ / C++] 5575번 : 타임 카드 (0) | 2023.03.31 |
[BOJ / C++] 17388번 : 와글와글 숭고한 (0) | 2023.03.30 |
[BOJ / C++] 3187번 : 양치기 꿍 (0) | 2023.03.26 |
[BOJ / C++] 11948번 : 과목선택 (0) | 2023.03.26 |