Discription
A square number is an integer number whose square root was also an integer. For example 1, 4, Bayi is some square numbers. Given numbers A and b you'll have to find out how many square numbers is there between A and B (inclusive).
Input
The input file contains at most 201 lines of inputs. Each line contains integers a and b (0 < a≤b≤100000). Input is terminated by a line containing the zeroes. This is should not being processed.
Output
For each line of input produce one line of output. This line contains an integer which denotes how many square numbers is there between A and B (inclusive).
Sample Input
1 4
1 10
0 0
Sample Output
2
3
Analysis
It's a very simple math problem. (first time to participate in the school race to do the first question, the placid ac .....) )
AC Code
#include <iostream> #include <cstdio> #include <cmath>using namespace std;int main (int argc, char const *argv[]) {int A, b;while ((scanf ("%d%d", &a, &b) = = 2) {if (a = = 0 && b = = 0) break;printf ("%d\n", (int) (Flo or (sqrt (b))-Ceil (sqrt (a)) + 1);}}
UVA 11461 Square numbers Problem solving report