# 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(枚举 + 数学) 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)