Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#2 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#3 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#4 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#5 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#6 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#7 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#8 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#9 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#10 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#11 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#12 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#13 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#14 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#15 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#16 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#17 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#18 |
Esperando resultado...
|
||
#19 |
Esperando resultado...
|
||
#20 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#21 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#22 |
Esperando resultado...
|
||
#23 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
||
#24 |
Error de compilación
Main.java:3: error: class MaxSum is public, should be declared in a file named MaxSum.java public class MaxSum { ^ 1 error |
import java.util.Scanner; public class MaxSum { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = Integer.parseInt(scanner.nextLine()); long[] a = new long[n]; int i = 0; for (String s : scanner.nextLine().split(" ")) { a[i] = Long.parseLong(s); i++; } long acummulator = a[0]; long best = acummulator; for (i = 1; i < n; i++) { acummulator = Math.max(a[i], acummulator + a[i]); best = Math.max(best, acummulator); } System.out.println(best); scanner.close(); } }