Don't pass me the ball.

Source: Internet
Author: User

Title Description Description

The CCC football match is a little different from the traditional football game, when a goal is scored in ascending order and only if the 4 players who have come into contact with the ball have the shirt number.

The player's shirt number is from 1 to 99, and each person's number is different.

Given the last scoring player's shirt number, please figure out how many legitimate combinations of players will be able to produce this goal.

Enter a description Input Description

Enter an integer 1<=j<=99 that represents the player's shirt number

Output description Output Description

The output has only one row and contains an integer that represents the number of combinations that make the player with the last goal numbered J.

Sample input Sample Input

Sample Input 1:4

Sample Input 2:2

Sample Input 3:90

Sample output Sample Output

Sample Output 1:1

Sample Output 2:0

Sample Output 3:113,564


This question test our permutation combination, but Ben Little did not learn this thing, but anyway, find the law everyone is will!

We can make a special judgment on this topic by the j<4, there is no answer

Since the requirement is four players, the first player's value range is 1~j-3, which means we can j-2,j-1,j the three players ignored, from the previous players to discuss.

F (4) =f (1+3) =1

F (5) =f (2+3) =2+1+1 = 2*1 + 1*2

F (6) =f (3+3) =3+2+1+2+1+1 = 3*1 + 2*2 + 1*3

F (7) =f (4+3) =4+3+2+1+3+2+1+2+1+1 = 4*1 + 3*2 + 2*3 + 1*4

So it's not hard to launch

F (i+3) =i*1+ (i-1) *2+ (i-2) *3+......+2* (i-1) +1*i

/*Super-Simple code*/#include<iostream>using namespacestd;Long Longans;intN;intMain () {CIN>>N; if(n<4) {cout<<0;return 0;} intk=n-3;  for(intI=1, j=k;i<=k;i++,j--) ans+=i*J; cout<<ans;}

Don't pass me the ball.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.