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 |
trouble#include <stdio.h> #include <math.h> long a,b; long process( void ); int main() { int sum ; int i, j ; while( scanf( "%d" , &sum ) == 1 ) { for( j=0 ; j < sum ; j++){ scanf( "%ld%ld", &a, &b ); printf( "%ld" , process() ) ; printf("\n"); } } return 0; } long process( void ) { long i; long length = b - a ; printf( "length=%ld " , length ) ; long mid = sqrt(length) ; printf( "mid=%ld" , mid ) ; if ( length==0 ) return 0; if ( length==1 ) return 1; if ( length>mid*mid && length<= mid*(mid+1) ) return 2*mid-1; if ( length<=(mid+1)*(mid+1) && length> mid*(mid+1) ) return 2*mid; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator