ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1438. Time Limit Exceeded

WA(7) Anyone help me?
Posted by chenll 6 Mar 2006 17:22
I got WA on test 7.
Is there some tricks on it?
There are % operations in this test. Check if you calculate it correctly (-)
Posted by Dmitry 'Diman_YES' Kovalioff 6 Mar 2006 18:41
Re: There are % operations in this test. Check if you calculate it correctly (-)
Posted by chenll 6 Mar 2006 18:46
int modFunction(int a,int b)
{
    int c=a%b;
    b=(b<0)?(-b):b;
    if(c<0)
        return c+b;
    return c;
}
is this correct?
I used the following construction (+)
Posted by Dmitry 'Diman_YES' Kovalioff 6 Mar 2006 18:51
func Mod(a,b: int): int;
var
   Res: int;
{
   Res:=a%b;
   if Res<0 then Res:=Res+abs(b);
   return Res;
}
Re: I used the following construction (+)
Posted by chenll 6 Mar 2006 19:00
i think we are the same.
So your mistake is somewhere else. Good luck (-)
Posted by Dmitry 'Diman_YES' Kovalioff 6 Mar 2006 19:06