College take no. Of groups of students as(N) and students has to get in a hyperloop which has single (S)or double (D)seat pod. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

College take no. Of groups of students as(N) and students has to get in a hyperloop which has single (S)or double (D)seat pod.

if a group consist of one person it uses S if none of the S is not available then use D and still none available then student service of hyperloop denied that has to be obtained output .the following is the test case :- input-4 1 2 //here 4 is no. of groups 1 2 1 1 //4 groups having students size output-0 // no one is denied as 1+4"1+2×2"=1+2+1+1 input-4 1 1 // 1 S ,1 D 1 1 2 1 output-2 //2 will be denied as 1+1=! 1+1+2+1 2-5=-2 so the answer is 2

16th Jan 2018, 3:47 PM
Nikhil Kohli
Nikhil Kohli - avatar
0 Answers