My issue
please help me identify error in my code
My code
#include<iostream>
#include<vector>
#include<string>
using namespace std;
bool isDigit(int n) {
string s = to_string(n);
for(int i=0;i<s.size();i++) {
if(s[i]=='0' or s[i]=='1' or s[i]=='4' or s[i]=='9') continue;
return false;
}
return true;
}
int main(){
vector<int> v;
for (int j = 1; j < 1E5+9; j++)
{
if (isDigit(j*j))
{
v.push_back(j*j);
}
}
int T;
cin>>T;
for (int i = 0; i < T; i++)
{
int n,m;
cin>>n>>m;
cout<<lower_bound(v.begin(),v.end(),m+1)-lower_bound(v.begin(),v.end(),n)<<endl;
}
return 0;
}
Problem Link: SDSQUARE Problem - CodeChef