fork download
  1. #include <iostream>
  2. #include<math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. // your code here
  8. int i,t,j,k,l,m,n,a,b,temp;
  9. cin>>t;
  10. while(t--)
  11. {
  12. cin>>n;
  13. a=sqrt(n);
  14. m=0;
  15. for(i=2;i<=a;i++)
  16. {
  17. if(n%i==0)
  18. {
  19. m+=i;
  20. m+=n/i;
  21. if(n/i==i)
  22. m=m-i;
  23. }
  24.  
  25. }
  26. cout<<(m+1)<<endl;
  27. }
  28.  
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 2744KB
stdin
1
9
stdout
4