Răspuns:
#include<iostream>
using namespace std;
int main()
{
long long s=0;
int ogl,n,v[1001],i,j;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>v[i];
ogl=0;
while(v[i]!=0)
{
ogl=ogl*10+v[i]%10;
v[i]=v[i]/10;
}
for(j=1;j*j<=ogl;j++)
{
if(j*j==ogl)
s=s+j;
else if(ogl%j==0 && j*j!=ogl)
s=s+j+ogl/j;
}
}
cout<<s;
return 0;
}
Explicație: