-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquares.cpp
More file actions
34 lines (32 loc) · 794 Bytes
/
squares.cpp
File metadata and controls
34 lines (32 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int T;
int a,b;
cin >> T;
for(int i=0;i<T;i++) {
cin >> a >> b;
int sqrt_a=(int)sqrt(a);
cout << "sqrt_a" << sqrt_a << endl;
int start=sqrt_a*sqrt_a;
cout << "start" << start << endl;
if(start < a) {
sqrt_a++;
start=sqrt_a*sqrt_a;
}
cout << "changed start" << start << endl;
int count=0;
while(start >= a && start <= b) {
count ++;
sqrt_a++;
start=sqrt_a*sqrt_a;
}
cout << count << endl;
}
return 0;
}