/*Adrian Brodzik*/ #include<iostream> using namespace std;int f(int n){int x=0;while(n>0){int m=(n%10);x+=m*m;n/=10;}return x;}int main(){ios_base::sync_with_stdio(0);long long k,a,b,i;cin>>k>>a>>b;i=a;a=0;for(i;i<=b;i++)if(k*f(i)==i)a++;cout<<a;return 0;}
1 2 3 | /*Adrian Brodzik*/ #include<iostream> using namespace std;int f(int n){int x=0;while(n>0){int m=(n%10);x+=m*m;n/=10;}return x;}int main(){ios_base::sync_with_stdio(0);long long k,a,b,i;cin>>k>>a>>b;i=a;a=0;for(i;i<=b;i++)if(k*f(i)==i)a++;cout<<a;return 0;} |