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

求助呀!不知道为什么不是超时就是WA

Posted by hdm29682 at 2006-02-19 18:30:58 on Problem 1650
#include <stdio.h>
int main(){
	long double a,mm=100000000.0,t,tt;int mi=0,mj=0,l;
	scanf("%lf%d",&a,&l);
	for(int i=1;i<l;i++)
		for(int j=i*int(a);j<l;j++){
			t=(a-(double)j/(double)i);
			tt=t;
			if(t<0)t=-t;
			if(t<mm){
				mi=j;mj=i;mm=t;
			}
			if(tt<0)break;			
		}
	printf("%d %d",(int)mi,(int)mj);
}

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