Pagini recente » Cod sursa (job #1195863) | Cod sursa (job #3147275) | Cod sursa (job #1422041) | Cod sursa (job #1924001) | Cod sursa (job #1709094)
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
freopen("consecutive.in", "r", stdin);
freopen("consecutive.out", "w", stdout);
int tests; scanf("%d", &tests);
while (tests--) {
long long x; scanf("%lld", &x);
vector<pair<int, int>> sol;
long long sum = 0;
for (long long nr = 2; ; ++nr) {
sum += nr - 1;
long long y = x - sum;
if (y > 0 && y % nr == 0) {
long long start = y / nr;
sol.push_back(make_pair(start, start + nr - 1));
}
if (y <= 0) {
break;
}
}
printf("%d\n", (int) sol.size());
for (auto &p : sol) {
printf("%d %d\n", p.first, p.second);
}
}
return 0;
}