█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 4280

Problema 0x25 - Suma de un subarreglo

  • Autor: arturor72
  • Fecha: 2021-06-05 00:19:22 UTC (Hace 4 meses)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#2
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#3
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#4
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#5
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#6
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#7
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#8
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#9
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#10
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#11
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#12
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#13
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
#14
Error de compilación
                      Main.java:2: error: class, interface, or enum expected
    public static void main(String... args){                                    
                  ^
Main.java:4: error: class, interface, or enum expected
        int n=sc.nextInt();                                                     
        ^
Main.java:5: error: class, interface, or enum expected
        int arr[]=new int[n];                                                   
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
        ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                     ^
Main.java:6: error: class, interface, or enum expected
        for(int i=0; i<n; i++){                                                 
                          ^
Main.java:8: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
        ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                     ^
Main.java:10: error: class, interface, or enum expected
        for(int i=0; i<consulta; i++){                                          
                                 ^
Main.java:12: error: class, interface, or enum expected
            int q=sc.nextInt();                                                 
            ^
Main.java:13: error: class, interface, or enum expected
            int c=0;                                                            
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                         ^
Main.java:14: error: class, interface, or enum expected
            for(int j=p; j<=q; j++) c+=arr[j];                                  
                               ^
Main.java:15: error: class, interface, or enum expected
            System.out.println(c);                                              
            ^
Main.java:16: error: class, interface, or enum expected
        }                                                                       
        ^
Main.java:18: error: class, interface, or enum expected
    }                                                                           
    ^
18 errors

                    
Puntos totales: 0 / 100

Código

                                                    
    public static void main(String... args){                                    
        Scanner  sc=new  Scanner(System.in);                                    
        int n=sc.nextInt();                                                     
        int arr[]=new int[n];                                                   
        for(int i=0; i<n; i++){                                                 
            arr[i]=sc.nextInt();                                                
        }                                                                       
        int consulta=sc.nextInt();                                              
        for(int i=0; i<consulta; i++){                                          
            int p=sc.nextInt();                                                 
            int q=sc.nextInt();                                                 
            int c=0;                                                            
            for(int j=p; j<=q; j++) c+=arr[j];                                  
            System.out.println(c);                                              
        }                                                                       
        sc.close();                                                             
    }