Cod sursa(job #2347560)
Utilizator | Petruta George-Calin GeorgeCalin | Data | 18 februarie 2019 21:19:05 |
---|---|---|---|
Problema | Consecutive | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva ICPC | Marime | 0.68 kb |
#include <fstream>
#define nmax 150002
using namespace std;
ifstream fin("consecutive.in");
ofstream fout("consecutive.out");
int sol[nmax],sol1[nmax];
long long c=0;
int main()
{
long long n,t;
fin>>t;
for(int i=1;i<=t;i++)
{
c=0;
fin>>n;
for(int 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;
}