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 jeco at 2006-04-21 21:24:37 on Problem 1061
#include <iostream>
#include <cmath>
int main()
{
	unsigned long x,y,m,n,l;
	std::cin>>x>>y>>m>>n>>l;
	if((abs(x-y)%abs(m-n))||x==y)	std::cerr<<"Impossible"<<std::endl;
	else
	{int i=0;
	do
		{x+=m;
		 if(x>=l)	x-=l;
		 y+=n;
		 if(y>=l)	y-=l;
		 i++;
		}
	while(x-y);
	std::cout<<i<<std::endl;
	}
	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