import java.io.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays; 
class A
{
    public static void main(String args[])throws IOException
    {
       
        Scanner input = new Scanner(System.in);
         int t = input.nextInt();
        int x;
        for(x=1;x<=t;x++){
         
         int n = input.nextInt();
         int k = input.nextInt();
           int a[]=new int[n];
           int i;
           for(i=0;i<n;i++)
           a[i] = input.nextInt();
           Arrays.sort(a);
           
           int max=0,index=0;
           for(int g=0;g<a[n-1];g++){
               if(index==n){break;}
               
             for(int h=1;h<=k;h++){
                 if(index==n){break;}
                if(g<a[index]){max++;index++;}
                else{index++;break;}
                }
                
            }
           System.out.println("Case #"+x+": "+max);
        }
        
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/4351c735-6a9d-4b06-938f-aff64f05d57e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to