Sort by

recency

|

175 Discussions

|

  • + 0 comments

    return(n*m-1)

  • + 0 comments

    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.

  • + 0 comments

    Python easiest solution: def solve(n, m): return m*n-1 For understanding try comparing the values as bigger and smaller and multiply them.

  • + 0 comments
    n,m = map(int, input().split())
    x= n*m
    if x ==1:
        print(0)
    else:
        print(x-1)
    
  • + 0 comments

    This is an interesting problem !

    Got stuck at 3/8 test cases ?

    • Think of it as single paper which need to be divided into N*M parts.
    • As per question one cut produces 1 extra part (1 page + 1 cut = 2 part of page now )
    • We need total of N*M parts since we already have 1 paper so just need N*M -1 more cuts to get our work done.