返回列表 發帖
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;

  4. public class Squeeezy {
  5.         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  6.         String raw[];
  7.         int c, t;

  8.         Squeeezy() throws Exception {
  9.                 raw = br.readLine().split(" ");
  10.                 for (int i = 0, len = raw.length; i < len; i++) { // i=0;i<raw.length;i++
  11.                         t = Integer.parseInt(raw[i]);
  12.                         if (i == 0)
  13.                                 c = 0;
  14.                         t = 0;
  15.                         c = Math.max(c + t, t);
  16.                         t = Math.max(c, t);
  17.                 }
  18.                 System.out.println(t);
  19.         }

  20.         public static void main(String[] args) throws Exception {
  21.                 new Squeeezy();
  22.         }

  23. }
複製代碼
林祐霆

TOP

返回列表