Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我都快疯掉了,这样都超时???哪位帮忙看一下,谢谢!!

Posted by houxuanfelix at 2006-04-07 21:46:48 on Problem 1061
#include <stdio.h>
int main()
{
    long  x,y,m,n,l,p,t,count;
    scanf ("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&l);
    if (m<n)
    {     t=m;  m=n;  n=t;
          t=x;  x=y;  y=t;
    }
    if (x>y)     p=l-(x-y);
    if (x<y)     p=y-x;
    m=m-n;
    if (m==0)    printf ("Impossible\n");
    else  
    {
       count=p/m;
       while (p%m)
       {
          p=(l+p)%m;
          count+=(l+p)/m;
       }
       printf ("%ld\n",count);
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator