Pagini recente » Cod sursa (job #921443) | Cod sursa (job #2437025) | Cod sursa (job #522832) | Rating Remus MP (remusmp) | Cod sursa (job #2059448)
#include <bits/stdc++.h>
using namespace std;
vector< pair<int, int> > sol;
ifstream fin("consecutive.in");
ofstream fout("consecutive.out");
long int go(long int N)
{
long int count = 0;
for (long int L = 1; L * (L + 1) < 2 * N; L++)
{
float a = (1.0 * N-(L * (L + 1)) / 2) / (L + 1);
if (a-(int)a == 0.0)
{
sol.push_back({a, a + L});
count++;
}
}
return count;
}
int main()
{
int t;
fin >> t;
while (t--)
{
int n;
cin >> n;
fout << go(n) << endl;
for (auto e : sol)
{
fout << e.first << " " << e.second << endl;
}
}
return 0;
}