Accepted solution

URI 1046 solution

Open original problem
Source code

#include <stdio.h>

int main() {

  int a,b,counta=0,countb=0;

    scanf("%d %d",&a,&b);

    if(a>b)

    {

        for(counta=0; a<24; counta++,a++)

            for(countb=0; countb<b; countb++){}

        printf("O JOGO DUROU %d HORA(S)
",counta+countb);

    }

    else if(b>a)

    {

        for(counta=0; a<b; counta++,a++){}

        printf("O JOGO DUROU %d HORA(S)
",counta+countb);

    }

    else if(a==b)

    {

        printf("O JOGO DUROU 24 HORA(S)
");

    }

    return 0;

}
Join the discussion

Add your comment