시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB12998112051070586.610%

문제

베라는 상의 N 벌과 하의 N 벌이 있다. i 번째 상의와 i 번째 하의는 모두 색상 i를 가진다. N 개의 색상은 모두 서로 다르다.

상의와 하의가 서로 다른 색상인 조합은 총 몇 가지일까?

입력

입력은 아래와 같이 주어진다.

N

출력

상의와 하의가 서로 다른 색상인 조합의 가짓수를 출력한다.

제한

  • 1 ≤ N ≤ 2017
  • N은 정수이다.

예제 입력 1

1

예제 출력 1

0

예제 입력 2

2

예제 출력 2

2

예제 입력 3

5

예제 출력 3

20
W3sicHJvYmxlbV9pZCI6IjE1NDM5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHViY2EwXHViNzdjXHVjNzU4IFx1ZDMyOFx1YzE1OCIsImRlc2NyaXB0aW9uIjoiPHA+XHViY2EwXHViNzdjXHViMjk0IFx1YzBjMVx1Yzc1OCBOIFx1YmM4Y1x1YWNmYyBcdWQ1NThcdWM3NTggTiBcdWJjOGNcdWM3NzQgXHVjNzg4XHViMmU0LiBpIFx1YmM4OFx1YzlmOCBcdWMwYzFcdWM3NThcdWM2NDAgaSBcdWJjODhcdWM5ZjggXHVkNTU4XHVjNzU4XHViMjk0IFx1YmFhOFx1YjQ1MCBcdWMwYzlcdWMwYzEgaVx1Yjk3YyBcdWFjMDBcdWM5YzRcdWIyZTQuIE4gXHVhYzFjXHVjNzU4IFx1YzBjOVx1YzBjMVx1Yzc0MCBcdWJhYThcdWI0NTAgXHVjMTFjXHViODVjIFx1YjJlNFx1Yjk3NFx1YjJlNC48XC9wPlxyXG5cclxuPHA+XHVjMGMxXHVjNzU4XHVjNjQwIFx1ZDU1OFx1Yzc1OFx1YWMwMCBcdWMxMWNcdWI4NWMgXHViMmU0XHViOTc4IFx1YzBjOVx1YzBjMVx1Yzc3OCBcdWM4NzBcdWQ1NjlcdWM3NDAgXHVjZDFkIFx1YmE4NyBcdWFjMDBcdWM5YzBcdWM3N2Ncd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IFZlcmEgbGlrZXMgb3V0Zml0cyB3aGVyZSB0aGUgdG9wIGFuZCBwYW50cyBhcmUgbm90IHRoZSBzYW1lIGNvbG91ci48XC9wPlxyXG5cclxuPHA+SG93IG1hbnkgZGlmZmVyZW50IG91dGZpdHMgZG9lcyBzaGUgbGlrZT88XC9wPlxyXG4iLCJpbnB1dCI6IjxwPlRoZSBpbnB1dCB3aWxsIGJlIGluIHRoZSBmb3JtYXQ6PFwvcD5cclxuXHJcbjxwcmU+XHJcbk5cclxuPFwvcHJlPlxyXG4iLCJvdXRwdXQiOiI8cD5PdXRwdXQgb25lIGxpbmUgd2l0aCB0aGUgbnVtYmVyIG9mIGRpZmZlcmVudCBvdXRmaXRzIFZlcmEgbGlrZXMuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCIsImxpbWl0IjoiPHVsPlxyXG5cdDxsaT4xICZsZTsgTiAmbGU7IDIwMTc8XC9saT5cclxuXHQ8bGk+TiBpcyBpbnRlZ2VyPFwvbGk+XHJcbjxcL3VsPlxyXG4ifV0=

출처

Contest > Waterloo's local Programming Contests > 4 March, 2017 A번

  • 문제를 번역한 사람: kiwiyou