Lucian_Adrian

#3272 SumDivOgl

Nov 2nd, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n , x , ogl;
  8.     long long S = 0;
  9.     for(cin >> n ; n ; --n)
  10.     {
  11.         cin >> x;
  12.         ogl = 0;
  13.         while(x)
  14.             ogl = ogl * 10 + x % 10, x /= 10;
  15.         long long S1 = 0;
  16.         for(int d = 1 ; d * d <= ogl ; d ++)
  17.             if(ogl % d == 0)
  18.             {
  19.                 S1 += d;
  20.                 if(d * d < ogl)
  21.                     S1 += ogl / d;
  22.             }
  23.         S += S1;
  24.     }
  25.     cout << S << endl;
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment