나는 이렇게 학습한다/Algorithm & SQL

0202. Beginner Series #1 School Paperwork

daco2020 2023. 2. 2. 22:13
반응형

Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages.

Your task is to calculate how many blank pages do you need. If n < 0 or m < 0 return 0.

Example:

n= 5, m=5: 25
n=-5, m=5:  0

Waiting for translations and Feedback! Thanks!



Solution:

def only_int(func):
    def wrapper(n, m):
        if n < 0 or m < 0:
            return 0
        return func(n, m)
    return wrapper

@only_int
def paperwork(n, m):
    return n * m  


반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

0204. Filter the number  (0) 2023.02.04
0203. Parse float  (0) 2023.02.03
0201. Who ate the cookie?  (0) 2023.02.01
0131. You only need one - Beginner  (0) 2023.02.01
0130. Grasshopper - Personalized Message  (0) 2023.01.31