Update appNew update is available. Click here to update.

Choose Students

Contributed by
Pankaj Sharma
Last Updated: 23 Feb, 2023
Medium
yellow-spark
0/80
Avg time to solve 25 mins
Success Rate 75 %
Share
5 upvotes

Problem Statement

You are the teacher of a class and you have N students in the class. You are asked to choose R students from your class for a competition. All your students are equally competent. Find the number of ways you can choose R students from a class of N students.

Note : Number of ways of choosing 0 students from N students is 1.

Detailed explanation ( Input/output format, Notes, Images )
Constraints :
1 <= T <= 10
1 <= N <= 200
0 <= R <= N
where ‘T’ is the number of test cases, ‘N’ is the total number of students in the class and ‘R’ is the number of students to choose.

Sample Input 1:

1
3 2

Sample Output 1:

3

Explanation of Sample Input 1:

Ways to choose 2 students from 3 : {1,2}, {1,3}, {2,3}.

Sample Input 2:

3
4 1
5 5
3 0

Sample Output 2:

4
1
1
Reset Code
Full screen
Auto
copy-code
Console