Pagini recente » Cod sursa (job #467507) | Cod sursa (job #1707578) | Cod sursa (job #1934308) | Cod sursa (job #1600823) | Cod sursa (job #2241202)
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
long long a[100001];
long long b[100001];
int main()
{
ifstream fin ("consecutive.in");
ofstream fout ("consecutive.out");
int t, contor;
fin >> t;
for (int i = 1; i <= t; ++i) {
long long suma;
contor = 0;
fin >> suma;
for (long long x = 2; x * x <= 2 * suma; ++x) {
long long result = 2 * suma - x * x + x;
if (result % (2 * x) == 0) {
result /= (2 * x);
if (result > 0) {
contor += 1;
a[contor] = result;
b[contor] = (result + x - 1);
}
}
}
fout << contor << '\n';
for (int i = 1; i <= contor; ++i) {
fout << a[i] << ' ' << b[i] << '\n';
}
}
return 0;
}