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.

Zigrik     2024-10-20 20:20:16

Добавьте пожалуйста в описание критерий четности грудей свиней. "Любое количество грудей" очень путает.

Please add the note about even number of breasts, it's confusing otherwise.

ecolog_veteran     2024-10-22 17:31:36
User avatar

Внизу под входными данными уже есть заметка по этому поводу: / there is a note on this alread, at the bottom

Note: of course we assume that all pigs have the same number of breasts... We also assume this number is even for pigs (as for most mammals)...

Zigrik     2024-10-23 06:46:45

Проморгал, прошу прощения. / ah, sorry, never mind

Rodion (admin)     2024-10-23 22:07:15
User avatar

Friends, please prefer English (no worry if with mistakes), at least until subforums for local languages are implemented :)

Not that anything is wrong with Russian particularly - it's just a bit impolite to talk in the language others don't understand well (either Russian or Indonesian etc).

Or feel free to contact me directly via VK.

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