Pagini recente » Atasamentele paginii Profil Arvinte_Dobreanu_Ionita_Iasi | Cod sursa (job #2748431) | Cod sursa (job #2819898) | Cod sursa (job #1771871) | Cod sursa (job #1709189)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int i,k, t, a[40000],b[40000], x;
long n;
int main()
{
freopen("consecutive.in", "r", stdin);
freopen("consecutive.out", "w", stdout);
scanf("%d", &t);
for(k=0; k<t; k++)
{
scanf("%ld", &n);
x = 0;
int M = (sqrt(1+8*n)-1)/2 + 1;
for(i = 2; i<M; i++)
{
if(i%2==0)
{
if((n%i)==(i/2))
{
a[x] = n/i - (i / 2 -1);
b[x] = n/i + i/2;
x++;
}
}
else
{
if(n%i==0){
a[x] = n/i - i/2;
b[x] = n/i + i/2;
x++;
}
}
}
printf("%d\n",x);
for(i=0;i<x;i++)
printf("%d %d\n", a[i], b[i]);
}
return 0;
}