Pagini recente » Cod sursa (job #541719) | Cod sursa (job #2922751) | Cod sursa (job #2002469) | Cod sursa (job #2274740) | Cod sursa (job #1709080)
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
using namespace std;
void solve(unsigned int n) {
unsigned int k = 0, p = 1, cnt = 0;
vector<pair<unsigned int, unsigned int>> sol;
for (unsigned int x = 2; x * (x + 1) <= 2 * n; ++x) {
p = x * (x + 1) / 2;
if ((n - p) % x == 0) {
k = (n - p) / x;
cnt++;
sol.emplace_back(k + 1, k + x);
}
}
cout << sol.size() << '\n';
for (const auto& p : sol) {
cout << p.first << ' ' << p.second << '\n';
}
}
int main() {
#ifdef INFOARENA
ifstream cin("consecutive.in");
ofstream cout("consecutive.out");
#endif
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
solve(N);
}
return 0;
}