SHARE
TWEET

Untitled

a guest Sep 21st, 2014 263 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma comment(linker, "/STACK:100000000")
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <memory.h>
  5. #include <cstring>
  6. #include <sstream>
  7. #include <cstdlib>
  8. #include <complex>
  9. #include <string>
  10. #include <bitset>
  11. #include <vector>
  12. #include <cstdio>
  13. #include <ctime>
  14. #include <cmath>
  15. #include <queue>
  16. #include <stack>
  17. #include <set>
  18. #include <map>
  19.  
  20. using namespace std;
  21.  
  22. typedef long long ll;
  23. typedef long double ld;
  24. typedef unsigned long long ull;
  25. typedef complex < double > cd;
  26.  
  27. const bool db = false;
  28.  
  29. #define mp make_pair
  30. #define pb push_back
  31. #define ppb pop_back
  32. #define sd second
  33. #define fs first
  34.  
  35. #define inf 1000000007
  36. #define nmax 100010
  37. #define mmax 500010
  38. #define pi acos(-1.0)
  39. #define eps 1e-7
  40.  
  41. int n, m;
  42. vector < pair < int, int > > Fact;
  43. vector < pair < ll, ll > > Ans;
  44.  
  45. void Rec(int pos, ll mul) {
  46.         if(pos == Fact.size()) {
  47.                 Ans.pb(mp(mul + m, m * 1LL * m / mul + m));
  48.                 return;
  49.         }
  50.         Rec(pos + 1, mul);
  51.         for(int j = 0; j < Fact[pos].sd; ++j) {
  52.                 mul *= Fact[pos].fs;
  53.                 Rec(pos + 1, mul);
  54.         }
  55. }
  56.  
  57. int main() {
  58.     //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  59.     //freopen("test.in", "r", stdin); freopen("test.out", "w", stdout);
  60.         cin >> n; m = n;
  61.         /*for(int i = 1; i <= n * n; ++i)
  62.                 if(n * n % i == 0) {
  63.                         cout << i + n << " " << n * n / i + n << endl;
  64.                 }*/
  65.         for(int i = 2; i * i <= n; ++i)
  66.                 if(n % i == 0) {
  67.                         Fact.pb(mp(i, 0));
  68.                         while(n % i == 0) {
  69.                                 ++Fact[Fact.size() - 1].sd;
  70.                                 n /= i;
  71.                         }
  72.                 }
  73.         if(n != 1)
  74.                 Fact.pb(mp(n, 1));
  75.         for(int i = 0; i < Fact.size(); ++i)
  76.                 Fact[i].sd *= 2;
  77.         Rec(0, 1);
  78.         cout << Ans.size() << endl;
  79.         for(int i = 0; i < Ans.size(); ++i)
  80.                 printf("%I64d %I64d\n", Ans[i].fs, Ans[i].sd);
  81.         //while(1);
  82.     return 0;
  83. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top