Advertisement
STANAANDREY

impo

Jan 4th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. long long S=0,n,i;
  9.  
  10. cin>>n;
  11. for (i=1;i<=sqrt(n);i++)
  12. if (n%i==0)
  13. {
  14. S+=i;
  15. if (n/i>i)
  16. S+=n/i;
  17. }
  18. cout << S;
  19. return 0;
  20. }
  21.  
  22.  
  23.  
  24. #include <fstream>
  25. using namespace std;
  26.  
  27. int main ()
  28. {
  29.     ifstream fin ("data.in");
  30.     ofstream fout("data.out");
  31.  
  32.    int n1,n2,i,j,v[102],w[102],s[104],n,aux=0;
  33.  
  34.       fin>>n1;
  35.       for (i=1;i<=n1;i++)
  36.     fin>>v[i];
  37.  
  38.     fin>>n2;
  39.     for (j=1;j<=n2;j++)
  40.     fin>>w[j];
  41.  
  42.     n=(n1>n2)?n1:n2;
  43.  
  44.     i=n;
  45.     while (i)
  46.    {
  47.        s[i]=v[i]+w[i]+aux;;
  48.        aux=0;
  49.        if (s[i]/10&&i!=1)
  50.        {
  51.            aux=1;
  52.            s[i]%=10;
  53.  
  54.        }
  55.        i--;
  56.    }
  57.  
  58.     for (i=1;i<=n;i++)
  59.         fout<<s[i];
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement