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

Envío 5056

Problema 0x25 - Suma de un subarreglo grande

  • Autor: cams2692
  • Fecha: 2021-10-08 15:26:20 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#2
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#3
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#4
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#5
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#6
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#7
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#8
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#9
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#10
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#11
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#12
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#13
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
#14
Error de compilación
                      # command-line-arguments
runtime.main_main·f: function main is undeclared in the main package

                    
Puntos totales: 0 / 100

Código

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type SubArrayData struct {
	P int64
	Q int64
}

func main1() {
	reader := bufio.NewReader(os.Stdin)

	reader.ReadString('\n')

	nArray, _ := reader.ReadString('\n')
	nArray = strings.ReplaceAll(nArray, "\n", "")
	numbers := strings.Split(nArray, " ")
	numberArray := make([]int64, 0)
	for i := 0; i < len(numbers); i++ {
		number, _ := strconv.ParseInt(numbers[i], 10, 64)
		numberArray = append(numberArray, number)
	}
	c, _ := reader.ReadString('\n')
	c = strings.ReplaceAll(c, "\n", "")
	cNumber, _ := strconv.ParseInt(c, 10, 64)

	for i := 0; i < int(cNumber); i++ {
		caseLine, _ := reader.ReadString('\n')
		caseLine = strings.ReplaceAll(caseLine, "\n", "")
		numbersCase := strings.Split(caseLine, " ")
		p, _ := strconv.ParseInt(numbersCase[0], 10, 64)
		q, _ := strconv.ParseInt(numbersCase[1], 10, 64)
		numbersTwo := numberArray[p : q+1]
		var sum int64 = 0
		for _, v := range numbersTwo {

			sum += v
		}
		fmt.Println(sum)
	}

}