Cod sursa(job #3364669)
| Utilizator | Data | 8 septembrie 2026 22:00:02 | |
|---|---|---|---|
| Problema | Consecutive | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva ICPC | Marime | 0.8 kb |
#include <fstream>
using namespace std;
ifstream cin("consecutive.in");
ofstream cout("consecutive.out");
struct ura
{
long long x;
long long y;
};
ura v[100000];
int main()
{
int T;
cin>>T;
while(T--)
{
long long n;
cin>>n;
int cnt=0;
for(long long d=2;d*2<=n;d++)
{
if((2*n)%d==0)
{
long long z=2*n/d-d+1;
if(z>0 and z%2==0)
{
long long x=z/2;
long long y=x+d-1;
v[++cnt].x=x;
v[cnt].y=y;
}
}
}
cout<<cnt<<"\n";
for(int i=1;i<=cnt;i++)
cout<<v[i].x<<" "<<v[i].y<<"\n";
}
return 0;
}
