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

Re:一般来说,最好不要用“绝对”两个字

Posted by liheng at 2007-10-26 20:11:21 on Problem 1061
In Reply To:一般来说,最好不要用“绝对”两个字 Posted by:xfxyjwf at 2007-10-26 15:50:32
#include <stdio.h>
int main(){
	__int64 x,y,m,n,L,s,minutes,count,detV,seq;
	scanf("%I64d %I64d %I64d %I64d %I64d",&x,&y,&m,&n,&L);
	if(x == y){
		printf("0\n");
		return 0;
	}
	else if(m == n){
		printf("Impossible\n");
		return 0;
	}
	else{
		x %= L;
		y %= L;
		if(m > n && x > y)
			s = (y - x)%L;
		else if(m < n && x < y)
			s = (x - y)%L;
		else
			s = x - y > 0 ? x - y : y - x;
		detV = m - n > 0 ? m - n : n - m;
		count = L / detV;
		L %= detV;
		minutes = s / detV;
		seq = (s %= detV);
		while(s){
			s += L;
			minutes += count;
			minutes += s / detV;
			s %= detV;
			if(s == seq){
				printf("Impossible\n");
				return 0;
			}
		}
		printf("%I64d\n",minutes);
	}
	return 0;
}
请告诉我以上这段程序在哪个测试点没有通过行不,因为我与AC的程序基本一模一样,而且您也说过了能AC的程序不一定正确,可是它可以通过的测试点为什么我不能过。

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