We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Cutting Paper Squares
Cutting Paper Squares
Sort by
recency
|
175 Discussions
|
Please Login in order to post a comment
return(n*m-1)
For C++, be careful about the funciton input types. If they are the int types, you may need to change them to the long types in order to avoid any overflows.
Yes. You will because they overflow. :)
Python easiest solution: def solve(n, m): return m*n-1 For understanding try comparing the values as bigger and smaller and multiply them.
Interestingly, if
x==1
,x-1
returns0
. So the condition is unnecessary.This is an interesting problem !
Got stuck at 3/8 test cases ?