A squarenumber is an integer number whose square root is also an integer. for example1, 4, 81 are some square numbers. given two numbers A and B you will have tofind out how many square numbers are there between A and B (random SIVE ).
Input
The input file contains at most 201 lines of inputs. each line contains two integers A and B (0 <a ≤ B ≤ 100000 ). input is terminated by a line containing two zeroes. this line shoshould not beprocessed.
Output
For each lineof input produce one line of output. This line contains an integer whichdenotes how many square numbers are there between A and B (random SIVE ).
Sampleinput outputfor sample input
Problem setter: Shahriar Manzoor
Question: calculate the total number of partitions between [a, B ].
Idea: amount .... The root number is the answer.
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int main() {int a, b;while (scanf("%d%d", &a, &b) != EOF && a+b) {int n = sqrt(a);int m = sqrt(b);int ans = m-n+1;if (n*n < a)ans--;printf("%d\n", ans);}return 0;}