Pagini recente » Cod sursa (job #1808502) | Cod sursa (job #3258386) | Cod sursa (job #2163889) | Cod sursa (job #133386) | Cod sursa (job #1708992)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int nmax = 100005;
int t;
ll n;
vector <pair <ll, ll>> v;
int main() {
ifstream f("consecutive.in");
ofstream g("consecutive.out");
f>>t;
while(t--) {
f>>n;
v.clear();
for(ll k=2; k*k<=2LL*n; k++) {
if(2LL*n % k != 0)
continue;
ll par = (2LL*n)/k;
ll x = (par + 1LL - k) / 2LL;
if(k * (2LL*x + k - 1LL) == 2LL * n) //solutie
v.push_back(make_pair(x, x+k-1));
}
g<<v.size()<<"\n";
for(auto t:v)
g<<t.first<<" "<<t.second<<"\n";
}
return 0;
}