problem 97 Girls and pigs ERROR CHECKER

Back to General discussions forum

MULTIVAC     2020-01-20 18:52:52
User avatar
Taking the example of entry 26 and 136 the checker informs  us of two solutions, however there are three, 
the third is: 9 GIRLS 2 PIGS of 59 BREAST. my code has calculated the values correctly but obviously it gives
error, I allow myself to share it.



import math
loops=int(input())
for i in range(loops):
    A,B=map(int,input().split())
    PosiblesSoluciones=0
    for n in range(B):
        if n!=4:
            cerdos=(A-B)/(4-n)
            chicas=(B-n*cerdos)/2
            if int(chicas)==chicas and int(cerdos)==cerdos  and cerdos>=0 and chicas>=0:
                #print("girls",chicas,"  picgs", cerdos," . sum: ")
                PosiblesSoluciones+=1
    print(PosiblesSoluciones,"")

I hope that this situation can be resolved promptly.
Rodion (admin)     2020-01-20 23:03:51
User avatar

Hi Friend and thanks for your message!

I hope that this situation can be resolved promptly.

I think I can help. The statement says: "We also assume this number [of breasts] is even for pigs", e.g. solution with 59 is not suitable.

Sorry for it is not highlighted. I can add this (as repetition) to example explanation if you think it will help other colleagues...

By the way it's amusing to read the variable names in, eh... Spanish? I think we have some words loaned from Spanish :)

Have a good day and my congratulations on such a high rank!

MULTIVAC
Position: #484 (among top 1.3%)

Very Good! :)

MULTIVAC     2020-01-21 01:51:32
User avatar

thank you very much! yepp i am from Colombia, thats spanish.

Please login and solve 5 problems to be able to post at forum