Skip to content

Instantly share code, notes, and snippets.

@matheustanaka
Created October 4, 2024 00:09
Show Gist options
  • Save matheustanaka/836b5c166e781735ad1c3d485dbbcb42 to your computer and use it in GitHub Desktop.
Save matheustanaka/836b5c166e781735ad1c3d485dbbcb42 to your computer and use it in GitHub Desktop.
dojo-golangsp
package main
import "fmt"
// https://judge.beecrowd.com/pt/problems/view/1168
func main() {
quantidadeInput := 0
// fmt.Println("Digite a quantidade de entradas")
fmt.Scanln(&quantidadeInput)
// fmt.Println(quantidadeInput)
valorUsuario := ""
for i := 0; i < quantidadeInput; i++ {
// fmt.Println("Digite uma entrada de valor: ")
fmt.Scanln(&valorUsuario)
// fmt.Println("Valor do Usuário: ", valorUsuario)
contagemLed := 0
for _, entrada := range valorUsuario {
// fmt.Println("Entrada:", string(entrada))
switch entrada {
case '1':
contagemLed += 2
case '2':
contagemLed += 5
case '3':
contagemLed += 5
case '4':
contagemLed += 4
case '5':
contagemLed += 5
case '6':
contagemLed += 6
case '7':
contagemLed += 3
case '8':
contagemLed += 7
case '9':
contagemLed += 6
default:
contagemLed += 6
}
}
fmt.Println(contagemLed, "leds")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment