Hi just checked out solution for  " Infinite house of pancakes" from webasite 
"go-hero.net".

I am able to get the purpose of  " for loop" for 1000 times with variable "eat".

Below is the code:
============================================
public class B {
        
        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                int T = sc.nextInt();
                for (int t = 1; t <= T; t++) {
                        int D = sc.nextInt();
                        int[] p = new int[D];
                        for (int i = 0; i < D; i++)
                                p[i] = sc.nextInt();
                        int best = 1000;
                        for (int eat = 1; eat <= 1000; eat++) {
                                int time = solve(p, eat);
                                best = Math.min(time, best);
                        }
                        
                        System.out.printf("Case #%d: %d\n", t, best);
                }
        }

        private static int solve(int[] p, int eat) {
                int special = 0;
                for (int i = 0; i < p.length; i++)
                        special += (p[i] - 1)/eat;
                return special + eat;
        }

}

-- 
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/0a643489-605a-401f-8adc-5832f07a9d88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to