SHARE
TWEET

code

a guest Sep 21st, 2014 244 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdio.h"
  2. #include "stdlib.h"
  3. #include <iostream>
  4. #include <set>
  5. #include <math.h>
  6. #pragma warning(disable : 4996)
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.         set<unsigned long long int> s;
  13.         unsigned long long int i, j, a, b, k, count = 0, d[500000], nd = 0;
  14.         cin >> k;
  15.         for (i = 1; i <= (unsigned long long int)sqrt(k); i++)
  16.         {
  17.                 if (k % i == 0)
  18.                 {
  19.                         d[nd] = i;
  20.                         nd++;
  21.                         d[nd] = k / i;
  22.                         nd++;
  23.                 }
  24.  
  25.         }
  26.         for (i = 0; i < nd; i++)
  27.         for (j = 0; j <= i; j++)
  28.         {
  29.                 if ((k * k) % d[i] * d[j] == 0)
  30.                 {
  31.                         s.insert(d[i] * d[j]);
  32.                 }      
  33.         }
  34.         cout << s.size() << endl;
  35.         for (set<unsigned long long int>::const_iterator it = s.begin(); it != s.end(); it++) {
  36.                 cout << k + (*it) << " " << k * k / (*it) + k << endl;
  37.         }
  38.         return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top