Advertisement
Spocoman

06. Wedding Seats

Sep 25th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.63 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var finalSector string
  7.     fmt.Scanln(&finalSector)
  8.    
  9.     var rows, oddSeats, totalSeats int
  10.     fmt.Scanln(&rows)
  11.     fmt.Scanln(&oddSeats)
  12.  
  13.      for i := int('A'); i <= int(rune(finalSector[0])); i++ {
  14.         for k := 1; k <= rows; k++ {
  15.             currentSeats := oddSeats
  16.             if k % 2 == 0 {
  17.                 currentSeats += 2
  18.             }
  19.             for o := int('a'); o < currentSeats + 97; o++ {
  20.                 fmt.Printf("%c%d%c\n", i, k, o)
  21.                 totalSeats++
  22.             }
  23.         }
  24.         rows++
  25.      }
  26.    
  27.      fmt.Println(totalSeats)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement