- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Ch01 {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- int crr,tot,data;
- String raw[];
- Ch01() throws Exception
- {
- raw=br.readLine().split(" ");
- for(int i=0; i<raw.length; i++)
- {
- data=Integer.parseInt(raw[i]);
- if(i==0)
- {
- crr=data;
- tot=data;
- }
- crr=Math.max(crr+data, data);
- tot=Math.max(crr, tot);
- }
- System.out.println(tot);
- }
- public static void main(String[] args) throws Exception {
- new Ch01();
- }
- //-2 1 -3 4 -1 2 1 -5 4
- }
複製代碼 |