- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class f314 {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- String raw[];
- int curmaxsum,totmaxsum;
- f314() throws IOException
- {
- raw=br.readLine().split(" ");
- for(int i=0;i<raw.length;i++)
- {
- int t=Integer.parseInt(raw[i]);
- if(i==0)
- {
- curmaxsum=t;
- totmaxsum=t;
- }
- curmaxsum=Math.max(curmaxsum+t, t);
- totmaxsum=Math.max(curmaxsum, totmaxsum);
- }
- System.out.println(totmaxsum);
- }
- public static void main(String[] args) throws IOException {
- new f314();
- }
- }
複製代碼 |