今天來解YKL07(UVA11461):Square Numbers
找出a~b之間,開完更號還是int的數字
output有幾個
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
if (a == 0 && b == 0) {
break;
}
int count = 0;
for (int i = a; i <= b; i++) {
double root = sqrt(i);
if (root == int(root)) {
count++;
}
}
cout << count << endl;
}
return 0;
}