[c] nam

Viewer

  1. #include<stdio.h>
  2. #include<math.h>
  3. typedef long long ll;
  4. const int N=1e6+3;
  5. bool a[N];
  6. void Eratosthene()
  7. {
  8.         int i,j;
  9.         for (i=2;i<=N;i++) a[i]=1;
  10.         a[0]=0;a[1]=0;
  11.         for (i=2;i*i<=10000;i++)
  12.         {
  13.                 if (a[i]==1)
  14.                 {
  15.                         for (int j=i*i;j<=10000;j+=i)
  16.                         {
  17.                                 a[j]=0;
  18.                         }
  19.                 }
  20.         }
  21. }
  22. /*ll tong(ll n)
  23. {
  24.         ll s=0;
  25.         for(int i=2;i<=sqrt(n);i++)
  26.         {
  27.                 if(n%i==0)
  28.                 {
  29.                         while(n%i==0)
  30.                         {
  31.                                 s+=i;
  32.                                 n/=i;
  33.                         }
  34.                 }
  35.         }
  36.         if(n>1) s+=n;
  37.         return s;
  38. }*/
  39. int main()
  40. {
  41.   ll n,s=0;
  42.   scanf("%lld",&n);
  43.   for(int i=1;i<=n;i++)
  44.   {
  45.       ll a;
  46.       scanf("%lld",&a);
  47.       s+=tong(a);
  48.   }
  49.   printf("%lld",s);
  50.   return 0;
  51. }
  52.  

Editor

You can edit this paste and save as new:


File Description
  • nam
  • Paste Code
  • 27 Feb-2021
  • 641 Bytes
You can Share it: