greenhelix
greenhelix
greenhelix
06-07 21:11
  • All (229)
    • Algorithm (118)
      • Algorithm (17)
      • Graph (0)
      • Core (6)
      • Python (18)
      • PythonSnippet (4)
      • Java (59)
      • Kotlin (14)
    • Project (0)
    • Study (8)
      • License (5)
      • EIP (3)
    • Programming (63)
      • Android (41)
      • Flutter (1)
      • Bugs Life (21)
      • Linux (0)
    • Tech (32)
      • Tech (17)
      • Drone (4)
      • Hacking (11)
    • Life (6)
      • INGRESS (1)
      • 심시티빌드잇 (0)
250x250

티스토리

hELLO · Designed By 정상우.
greenhelix

greenhelix

#4. Seats in Theater
Algorithm/Core

#4. Seats in Theater

2021. 11. 7. 22:47

내 자리가 col, row 라면, 내 뒷편의 자리의 왼쪽 전체 자리 총 몇 자리 인가?

 

파이썬

def seatsInTheater(nCols, nRows, col, row): return (nCols - col +1)*(nRows - row)

 

코틀린

fun seatsInTheater(nCols: Int, nRows: Int, col: Int, row: Int) = (nCols - col + 1) * (nRows - row)
728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Algorithm > Core' 카테고리의 다른 글

#5. Max Multiple  (0) 2021.11.07
#3. Candies  (0) 2021.11.02
#2. Largest Number  (0) 2021.11.02
    'Algorithm/Core' 카테고리의 다른 글
    • #6. Circle of Numbers
    • #5. Max Multiple
    • #3. Candies
    • #2. Largest Number
    greenhelix
    greenhelix
    개발에 관한 것들과 개인적인 것을 담는 블로그

    티스토리툴바