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

Show all messages Hide all messages

WA(7) Anyone help me? zt 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 (-) Dmitry 'Diman_YES' Kovalioff. Retired 6 Mar 2006 18:41
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 (+) Dmitry 'Diman_YES' Kovalioff. Retired 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;
}
i think we are the same.
So your mistake is somewhere else. Good luck (-) Dmitry 'Diman_YES' Kovalioff. Retired 6 Mar 2006 19:06