Processing math: 100%
Square root sum - MarisaOJ: Marisa Online Judge

Square root sum

Time limit: 1000 ms
Memory limit: 256 MB
For two non-negative integers a,b, calculate the sum of the floor of the square root for all integers i with a≤i≤b. In other words, calculate: ∑bi=a⌊√i⌋. Here, ⌊a⌋ denotes the greatest integer not greater than a. ### Input - Contains a single line with two positive integers a,b. ### Output - Print the result of the calculation. ### Constraint - 1≤a≤b≤1012. ### Sample Test **Input 1** 310 **Output 1** 17 **Explanation** ⌊√3⌋+⌊√4⌋+⌊√5⌋+⌊√6⌋+⌊√7⌋+⌊√8⌋+⌊√9⌋+⌊√10⌋ =1+2+2+2+2+2+3+3=17 **Input 2** 1429 **Output 2** 67