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

  4. public class Ch01 {
  5.         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  6.         String raw[];
  7.         int cMS, tMS;
  8.        
  9.         Ch01() throws Exception{
  10.                 raw=br.readLine().split(" ");
  11.                 for(int i=0, len=raw.length; i<len; i++){
  12.                         int t=Integer.parseInt(raw[i]);
  13.                         if(i==0){
  14.                                 cMS=t;
  15.                                 tMS=t;
  16.                         }
  17.                         cMS=Math.max(t, cMS+t);
  18.                         tMS=Math.max(cMS, tMS);
  19.                 }
  20.                 System.out.println(tMS);
  21.         }

  22.         public static void main(String[] args) throws Exception {
  23.                 new Ch01();
  24.         }

  25. }
複製代碼

TOP

返回列表