Cod sursa(job #3302419)

Utilizator RaresHonourRares Herinean RaresHonour Data 7 iulie 2025 14:04:29
Problema Consecutive Scor 0
Compilator cpp-64 Status done
Runda Arhiva ICPC Marime 0.68 kb
#include <fstream>
using namespace std;
ifstream cin("consecutive.in");
ofstream cout("consecutive.out");

const int nmax=100000ș
long long sol[nmax],sol1[nmax];
int c=0;

int main()
{
    long long n;
    int t;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        c=0;
        cin>>n;
        for(long long j=1;j*j<=2*n;j++)
            if((2*n)%(j+1)==0&&((2*n)/(j+1)-j)%2==0)
                if(((2*n)/(j+1)-j)/2!=0)
                {
                    sol[++c]=((2*n)/(j+1)-j)/2;
                    sol1[c]=sol[c]+j;
                }
        fout<<c<<"\n";
        for(int j=1;j<=c;j++)
            fout<<sol[j]<<" "<<sol1[j]<<"\n";
    }
    return 0;
}