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

  4. public class f314 {
  5.         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  6.         String raw[];
  7.         int curmaxsum,totmaxsum;
  8.         f314() throws IOException
  9.         {
  10.                 raw=br.readLine().split(" ");
  11.                 for(int i=0;i<raw.length;i++)
  12.                 {
  13.                         int t=Integer.parseInt(raw[i]);
  14.                         if(i==0)
  15.                         {
  16.                                 curmaxsum=t;
  17.                                 totmaxsum=t;
  18.                         }
  19.                         curmaxsum=Math.max(curmaxsum+t, t);
  20.                         totmaxsum=Math.max(curmaxsum, totmaxsum);
  21.                 }
  22.                 System.out.println(totmaxsum);
  23.         }       
  24.         public static void main(String[] args) throws IOException {
  25.                 new f314();
  26.         }
  27. }
複製代碼

TOP

返回列表