HDU1003

import java.util.Scanner;

public class HDU1003 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a, b, c, d, e, t, n, i, j;
        if (sc.hasNextInt()) {
            t = sc.nextInt();
            for (j = 1; j <= t; j++) {
                n = sc.nextInt();
                e = 0;
                b = -99999990;
                a = 1;
                c = d = 1;
                for (i = 1; i <= n; i++) {
                    e += sc.nextInt();
                    if (e > b) {
                        b = e;
                        c = a;
                        d = i;
                    }
                    if (e < 0) {
                        e = 0;
                        a = i + 1;
                    }
                }
                System.out.println("Case " + j + ":");
                System.out.println(b + " " + c + " " + d);
                if (j != t)
                    System.out.println();
            }
        }
    }
}
posted @ 2012-07-12 14:41  A_阿飞  阅读(143)  评论(0)    收藏  举报