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 |
贴代码留念~~#include <iostream> using namespace std; int main(){ int n,i; cin>>n; for(i=0;i<n;i++){ double x,y,temp; int sum=0,j=1,k,m; cin>>x>>y; temp=y-x; while(1){ temp-=2*j; sum+=2; if(temp<=0){ sum-=2; temp+=2*j; break; } j++; } if(temp-j>0) sum+=2; else sum++; if(x==y) sum=0; cout<<sum<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator