Friday, December 25, 2015

UVa 11461 - Square Numbers

// UVa 11461 - Square Numbers
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b && a && b) {
		int x = (int) sqrt(a);
		int y = (int) sqrt(b);
		if (x * x == a)
			x--;
		cout << y - x << endl;
	}
	return 0;
}

No comments:

Post a Comment