Here’s my solution.
I’m also having the same problem.[Time limit exceeded]
#include
using namespace std;
int divisor( int n)
{
int j=0,i;
for(i=1;i<n;i++)
{
if(n%i==0)
{
j=i+j;
}
}
return j;
}
int main()
{
int i,j,n,x=0,t;
cin>>t;
for(t;x<t;x++)
{
cin>>i;
j=divisor(i);
cout<<j<<endl;
}
return 0;