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

跪求0MS的算法!!!!(附C代码,已过)

Posted by 20054953 at 2007-01-18 21:10:39 on Problem 2590
这个是我的代码,哪个大牛看看说下怎么改可以是0MS啊!!!

#include<iostream>
using namespace std;
main()
{int n,x,y,s,c,m;
cin>>n;
while(cin>>x>>y)
{c=y-x;
s=0;
m=0;
while(1)
{m=m+(s+1)/2;
if(m>=c)break;
s++;
}
cout<<s<<endl;
}
}

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