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


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

  24.         }


  25.         public static void main(String[] args)throws Exception{
  26.                 new Ch01();

  27.         }

  28. }
複製代碼

TOP

返回列表