@@ -0,0 +1,2509 @@
+package algorithms.implementation;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/*%0D%0A * Problem Statement: %0D%0A * The professor is conducting a course on Discrete Mathematics to a class of N%0D%0A * students. He is angry at the lack of their discipline, and he decides to%0D%0A * cancel the class if there are fewer than K students present after the class%0D%0A * starts.%0D%0A * %0D%0A * Given the arrival time of each student, your task is to find out if the class%0D%0A * gets cancelled or not.%0D%0A * %0D%0A * Input Format: %0D%0A * The first line of the input contains T, the number of test cases. Each test%0D%0A * case contains two lines.%0D%0A * The first line of each test case contains two space-separated integers, N and%0D%0A * K.%0D%0A * The next line contains N space-separated integers, a1,a...,aN, representing%0D%0A * the arrival time of each student.%0D%0A * %0D%0A * If the arrival time of a given student is a non-positive integer (ai %3C= 0),%0D%0A * then the student enters before the class starts. If the arrival time of a%0D%0A * given student is a positive integer (ai %3E 0), the student enters after the%0D%0A * class has started.%0D%0A * %0D%0A * Output Format: %0D%0A * For each testcase, print %22YES%22 (without quotes) if the class gets cancelled%0D%0A * and %22NO%22 (without quotes) otherwise.%0D%0A * %0D%0A * Constraints: %0D%0A * 1 %3C= T %3C= 10%0D%0A * 1 %3C= N %3C= 1000%0D%0A * 1 %3C= K %3C= N%0D%0A * -100 %3C= ai %3C= 100, where i is an element of %5B1,N%5D%0D%0A * Note%0D%0A * If a student enters the class exactly when it starts (ai = 0), the student is%0D%0A * considered to have entered before the class has started.%0D%0A * %0D%0A * Sample Input: %0D%0A * 2%0D%0A * 4 3%0D%0A * -1 -3 4 2%0D%0A * 4 2%0D%0A * 0 -1 2 1%0D%0A * %0D%0A * Sample Output: %0D%0A * YES%0D%0A * NO%0D%0A */%0D%0Apublic class AngryProfessor %7B%0D%0A%0D%0Apublic static void main(String%5B%5D args) %7B%0D%0A        %0D%0A        Scanner sc = new Scanner(System.in);%0D%0A        int numCases = sc.nextInt();%0D%0A        %0D%0A        for (int i = 0; i %3C numCases; i++) %7B%0D%0A            int studentCount = sc.nextInt();%0D%0A            int onTimeStudentsRequiredForClass = sc.nextInt();%0D%0A            %0D%0A            int numOnTimeStudents = studentCount;%0D%0A            %0D%0A            for (int j = 0; j %3C studentCount; j++) %7B%0D%0A                int minutesLate = sc.nextInt();%0D%0A                %0D%0A                if (minutesLate %3E 0) %7B%0D%0A                    numOnTimeStudents--;%0D%0A                %7D%0D%0A            %7D%0D%0A            %0D%0A            if (numOnTimeStudents %3C onTimeStudentsRequiredForClass) %7B%0D%0A                System.out.println(%22YES%22);%0D%0A            %7D else %7B%0D%0A                System.out.println(%22NO%22);%0D%0A            %7D%0D%0A        %7D%0D%0A        sc.close();%0D%0A    %7D%0D%0A%7D

Add AngryProfessor