Hi there, 

Thanks for reaching out. In future, please post any Kick Start related 
questions on our Facebook group: 
https://www.facebook.com/groups/Googlekickstart.  
<https://www.facebook.com/groups/Googlekickstart>

Thanks,
Lizzie from the Kick Start Team 
<https://www.facebook.com/groups/Googlekickstart>

On Tuesday, August 13, 2019 at 9:08:53 AM UTC-7, Henrique RennĂ³ wrote:
>
> I think the correct check is:
>
> if(n%(k*k) == 0) printf("NO");
> else printf("YES");
>
> The candidate that puts one apple in each box fills all the boxes with k 
> apples n/k times, and at the end each box will have n/k apples. That's the 
> only possibility, so the other candidate must finish putting apples this 
> way. But the other candidate fills all the boxes by putting k*k apples, so 
> n must be divisible by k*k for the boxes to have the same amount of apples.
>
> Am Mo., 12. Aug. 2019 um 12:20 Uhr schrieb chitaranjan pradhan <
> [email protected]>:
>
>> Chef found KK empty boxes in the cooler and decided to fill them with 
>> apples. He ordered NN apples, where NN is a multiple of KK. Now, he just 
>> needs to hire someone who will distribute the apples into the boxes with 
>> professional passion.
>>
>> Only two candidates passed all the interviews for the box filling job. In 
>> one minute, each candidate can put KK apples into boxes, but they do it 
>> in different ways: the first candidate puts exactly one apple in each box, 
>> while the second one chooses a random box with the smallest number of 
>> apples and puts KK apples in it.
>>
>> Chef is wondering if the final distribution of apples can even depend on 
>> which candidate he hires. Can you answer that question?
>>
>> Note: The boxes are distinguishable (labeled), while the apples are not. 
>> Therefore, two distributions of apples are different if there is a box such 
>> that the number of apples in it when the first candidate finishes working 
>> can be different from the number of apples in it when the second candidate 
>> finishes working.
>>
>>
>> Example Input
>>
>> 3
>> 5 1
>> 4 2
>> 10 10
>>
>> Example Output
>>
>> NO
>> NO
>> YES
>>
>>
>>
>>
>> whats wrong in code 
>>    
>>    1. import java.util.*;
>>    2. import java.lang.*;
>>    3. import java.io.*;
>>    4.  
>>    5. /* Name of the class has to be "Main" only if the class is public. */
>>    6. class Sol
>>    7. {
>>    8.        public static void main (String 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string>[]
>>  args) throws java.lang.Exception 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception>
>>    9.        {
>>    10.               Scanner scrn=new Scanner(System 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system>.in);
>>    11.               int T=scrn.nextInt();
>>    12.               while(T>0)
>>    13.               {
>>    14.                       int N=scrn.nextInt();
>>    15.                       int K=scrn.nextInt();
>>    16.                       answer(N,K);
>>    17.                       T--;
>>    18.               }
>>    19.       }
>>    20.       public static void answer(int n,int k)
>>    21.       {
>>    22.               if(k==1)
>>    23.               {
>>    24.                       System 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system>.out.println("NO");
>>    25.               }
>>    26.               else{
>>    27.                       if((n/k)==k){
>>    28.                               System 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system>.out.println("NO");
>>    29.                       }
>>    30.                       else
>>    31.                       {
>>    32.                               System 
>> <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system>.out.println("YES");
>>    33.                       }
>>    34.               }
>>    35.       }
>>    36. }
>>    
>>
>>
>> On Mon, Aug 12, 2019 at 9:34 AM Xiongqi ZHANG <[email protected]> 
>> wrote:
>>
>>> Please read FAQ for more information.
>>>
>>> Something to note:
>>>
>>> 1. You must name your main class Solution (with exactly that 
>>> capitalization). It must contain a public main method. Furthermore, your 
>>> code must not contain any package definitions. (Note: Package declarations 
>>> are allowed in Kotlin.)
>>>
>>> 2. You need to print your answer in given format, i.e. Case #x: ans
>>> where x is the case number starting from 1 and ans is the answer that 
>>> test case.
>>>
>>> I slightly changed your code to address the issues above.
>>>
>>> ```Java
>>> import java.util.*;
>>> import java.io.*;
>>>
>>> class Solution {
>>>
>>>     public static int minSum(ArrayList<Integer> list) {
>>>         int len = list.size();
>>>         int sum = 0;
>>>         Collections.sort(list);
>>>         Collections.reverse(list);
>>>         //System.out.println(list);
>>>         for (int i = 1; i < len; i++) {
>>>             sum += list.get(0) - list.get(i);
>>>         }
>>>         return sum;
>>>     }
>>>
>>>     public static void main(String[] args) throws IOException {
>>>         BufferedReader ip = new BufferedReader(new 
>>> InputStreamReader(System.in));
>>>         int t = Integer.parseInt(ip.readLine());
>>>         for (int cas = 1; cas <= t; cas++) {
>>>             String[] firstLine = ip.readLine().trim().split(" ");
>>>             String[] secondLine = ip.readLine().trim().split(" ");
>>>
>>>             int N = Integer.parseInt(firstLine[0]);
>>>             int P = Integer.parseInt(firstLine[1]);
>>>
>>>             ArrayList<Integer> skillList = new ArrayList<Integer>();
>>>
>>>             for (int i = 0; i < N; i++) {
>>>                 skillList.add(Integer.parseInt(secondLine[i]));
>>>             }
>>>             Collections.sort(skillList);
>>>
>>>             int min = Integer.MAX_VALUE;
>>>
>>>             for (int i = 0; i <= N - P; i++) {
>>>                 ArrayList<Integer> temp = new ArrayList<Integer>();
>>>                 for (int j = 0; j < P; j++) {
>>>                     temp.add(skillList.get(i + j));
>>>                 }
>>>                 if (min > minSum(temp)) {
>>>                     min = minSum(temp);
>>>                 }
>>>             }
>>>             System.out.printf("Case #%d: %d%n", cas, min);
>>>         }
>>>     }
>>> }
>>> ```
>>> Your solution gave correct result for test set 1 (the visible test) but 
>>> it is not good enough to pass the test set 2 (the hidden test) as it is too 
>>> slow to meet the running time restriction. 
>>>
>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/google-code/f4361956-744f-4e41-85f2-7aaac43f8ed4%40googlegroups.com
>>> .
>>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-code/CAAGy8WuXVmKMMh-6SwYSznBrLr8AZ_GJ0WVha45ey%2B29F7aG%3DA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/google-code/CAAGy8WuXVmKMMh-6SwYSznBrLr8AZ_GJ0WVha45ey%2B29F7aG%3DA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Henrique
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/ff91d0eb-34c9-48c6-aa35-9543581338ce%40googlegroups.com.

Reply via email to