| ||||||||||
| 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 | |||||||||
跪求0MS的算法!!!!(附C代码,已过)这个是我的代码,哪个大牛看看说下怎么改可以是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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator