TABLETS
Tablets
The exams were conducted through the means of tabs,the examiners provided tabs to the candidates taking the online exam in each center. They have sourced around ‘X’ tabs. There are ‘n’ examination centres in the region.There is a list that gives the details of the candidates strength in each of these centers.
The tabs has to be distributed in as many centers as possible.Each candidate receives a tablet to take on the test. Tablets are provided to the exam centers only when it is possible to give a tab to all the candidates or else the candidates in those center will take part in the online exams through other means.
What would be the maximum number of exam centers to which he can provide the tabs?
Input Format :
The first line of the input consists of an integer ‘n’ that corresponds to the number of exam centers in that region.
The next n lines of the input consists of one integer each that correspond to the candidate strength in the n centers.
The last line of the input consists of an integer that corresponds to X, the number of tabs available.
Output Format:
Output consists of an integer that corresponds to the maximum number of exam centers to which tabs can be provided.
Sample Input 1:
10
5
6
7
10
9
8
4
2
1
3
17
Sample Output 1:
5
#include
int main()
{
int i,j,n,temp,X,c=0,sum=0,a[30];
scanf("%d",&n);
for(i=0;ia[j])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
for(i=0;i
Comments
Post a Comment