Pagini recente » Cod sursa (job #14115) | Cod sursa (job #12185) | Cod sursa (job #1204072) | Cod sursa (job #2687755) | Cod sursa (job #1708913)
#include<cstdio>
#include<vector>
using namespace std;
pair<int,int> solution[50000];
int main(){
freopen("consecutive.in","r",stdin);
freopen("consecutive.out","w",stdout);
int tests,test,n,l,i,solutionCount;
scanf("%d",&tests);
for(test=1;test<=tests;test++){
scanf("%d",&n);
solutionCount=0;
for(l=2;l*(l-1)/2<n;l++)
if((n-l*(l-1)/2)%l==0){
solutionCount++;
solution[solutionCount]=make_pair((n-l*(l-1)/2)/l,(n-l*(l-1)/2)/l+l-1);
}
printf("%d\n",solutionCount);
for(i=1;i<=solutionCount;i++)
printf("%d %d\n",solution[i].first,solution[i].second);
}
return 0;
}