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