Pagini recente » Cod sursa (job #2824154) | Cod sursa (job #1440447) | Cod sursa (job #2323966) | Cod sursa (job #1239543) | Cod sursa (job #1709112)
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
long long tests, n, limit, start;
vector< pair<long long, long long> > results;
int main() {
freopen("consecutive.in", "r", stdin);
freopen("consecutive.out", "w", stdout);
scanf("%lld", &tests);
for (int test = 0; test < tests; ++test) {
scanf("%lld", &n);
limit = (sqrt(1 + 8 * n) - 1) / 2;
results.clear();
for (long long step = 1; step < limit; ++step) {
if ((2 * n - step * (step + 1)) % (2 * (step + 1)) == 0) {
results.pb(mp(step, (2 * n - step * (step + 1)) / (2 * (step + 1))));
}
}
printf("%d\n", results.size());
for (int it = 0; it < results.size(); ++it) {
printf("%lld %lld\n", results[it].second, results[it].second + results[it].first);
}
}
fclose(stdin);
fclose(stdout);
return 0;
}