Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求助呀!不知道为什么不是超时就是WA#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator