Shil, Aditya and Utkarsh
Practice
3.7 (58 votes)
Mathematics
Open
Easy
Problem
77% Success 3526 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Shil, Aditya and Utkarsh go to a candy shop. There are N candies present in the shop, which are indexed from 1 to N. All three of them select one candy to eat.

However, a candy tastes delicious if and only if, the index of candy chosen by Shil is strictly less than the index of candy chosen by Aditya and the index of candy chosen by Aditya is strictly greater than index of candy chosen by Utkarsh.

To state in simple Mathematical terms, if Shil chooses ith candy, Aditya chooses jth candy and Utkarsh chooses kth candy, then the candies would taste delicious

if and only if i < j and j > k.

You have to find the total number of ways in which they can choose candies such that the candies would taste delicious to them. Note that all of them choose distinct number of candies i.e., i!=j and j!=k and i!=k.

Input format:
The only line of input consists of a single integer N denoting the total number of candies.

Output format:
Find the total number of ways by which all three can choose candies such that the candies would taste delicious to them.

Constraints:
3 ≤ N ≤ 1000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Ad-HocData StructuresOpenApprovedEasyMathamatics
Points:20
1 votes
Tags:
EasySimple-math
Points:20
23 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics