Cod sursa(job #3359918)
| Utilizator | Data | 6 iulie 2026 14:45:36 | |
|---|---|---|---|
| Problema | Consecutive | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva ICPC | Marime | 0.66 kb |
#include <fstream>
#include <vector>
using namespace std;
ifstream cin("consecutive.in");
ofstream cout("consecutive.out");
int main()
{
int t;
cin>>t;
while(t--){
vector<pair<int,int>>ans;
int n;
cin>>n;
n*=2;
for(int d=2;d*d<=n;d++){
if(n%d) continue;
int x=d,y=n/d;
int p,u;
p=(y-x+1)/2;
u=y-p;
ans.push_back({p,u});
}
cout<<ans.size()<<'\n';
for(auto e:ans){
cout<<e.first<<" "<<e.second<<'\n';
}
}
return 0;
}
/// x*a+1+2+3+...+x=x*a+x*(x+1)/2=x*(a+(x+1)/2)=n
