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