Advertisement
O_Egor

38

May 13th, 2022
767
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include <map>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <tuple>
  7. using namespace std;
  8.  
  9. int main()
  10. {  
  11.     int ans(0);
  12.     for (int i = 4099; i < 26985 + 1; ++i)
  13.     {
  14.         int tmp = i, cnt(0);
  15.         for (int j = 2; j < sqrt(i) + 1; ++j)
  16.         {
  17.             if (i % j == 0)
  18.                 cnt++;
  19.         }
  20.         if (cnt == 1)
  21.         {
  22.             while (tmp)
  23.             {
  24.                 ans += tmp % 10;
  25.                 tmp /= 10;
  26.             }
  27.         }
  28.        
  29.     }
  30.     cout << ans;
  31.     return 0;
  32. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement