#๐Ÿ”’ Not getting the desired output for a codeforce problem (rectangle cutting).

11 messages ยท Page 1 of 1 (latest)

unkempt matrixBOT
#

@deft glade

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

deft glade
#
t = int(input("Enter the no of test cases:- "))
print("Enter the lengths and breadth of the rectangle:- ",end="\n")
for i in range(t):
    tuple_ = eval(input())
    a, b = tuple_
    val = []
    case = 0
    if a % 2 == 0 and b % 2 != 0:
        if a != 2*b and b != a/2:
            val.append(True); print(True)
        else:
            val.append(False); print(False)

    elif b % 2 == 0 and a % 2 != 0:
        if a != b/2 and b != 2*a:
            val.append(True); print(True)
        else:
            val.append(False); print(False)

    elif a % 2 == 0 and b % 2 == 0:
        if case == 0:
            if a != 2*b and b != a/2:
                val.append(True); print(True)
            else:
                val.append(False); print(False)
        case = 1
        if case == 1:
            if a != b/2 and b != 2*a:
                val.append(True); print(True)
            else:
                val.append(False); print(False)
print(val)
torn cobalt
#

!code

#

!paste

unkempt matrixBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

torn cobalt
#

It's difficult for me to read on mobile

#

@deft glade

#

and instead of doing the check like this, I would suggest checking if min(a, b) is divisible by 2, if not then check the larger number is two times the smaller number

unkempt matrixBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.