###### Codeforces 599D Spongebob and Squares(枚举 + 数学)

@(K ACMer)

#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
#define xx first
#define yy second
const int mod = int(1e9) + 7, INF = 0x3fffffff, maxn = 1e5 + 41;
ull k;
vector<pair<ull, ull> > v;
pair<ull, ull> temp;
int main(void) {
cin >> k;
ull a = 1, b = 0;
ull i = 0;
while (++i) {
a = i * (i + 1) / 2;
b = b + (i - 1) * i / 2;
temp.xx = i, temp.yy = (k + b) / a;
if (temp.xx > temp.yy) break;
if ((k + b) % a == 0) v.push_back(temp);
}
int ans = (int)v.size() * 2;
if (v[v.size() - 1].yy == v[v.size() - 1].xx) ans--;
cout << ans << endl;
for (int i = 0; i < v.size(); i++) {
cout << v[i].xx << " " << v[i].yy << endl;
}
for (int i = (int)v.size() - 1; i >= 0; i--) {
if (v[i].yy == v[i].xx) continue;
cout << v[i].yy << " " << v[i].xx << endl;
}
return 0;
}



#### Codeforces 599D：Spongebob and Squares

2015-11-22 21:08:20

#### CodeForces 599D Spongebob and Squares(DP＋math)

2016-01-23 11:51:11

#### Codeforces 599D Spongebob and Squares【思维枚举+数学方程】

2017-03-19 15:48:04

#### CF 599D SpongeBob And Squares 数列+枚举二分

2018-03-28 17:35:42

#### Codeforces 599D Spongebob and Squares 【公式推导 暴力】

2015-12-05 21:38:53

#### Codeforces Round #332 (Div. 2) 599D Spongebob and Squares(数学)

2015-11-23 16:17:10

#### Codeforces 599C Day at the Beach 【思维】

2015-11-23 22:06:23

#### Codeforces 908A （New Year and Counting Cards）914A（Perfect Squares）

2018-02-22 21:45:04

#### 【Codeforces314E】Sereja and Squares

2017-12-19 14:50:02

## 不良信息举报

Codeforces 599D Spongebob and Squares(枚举 + 数学)