Cod sursa(job #1711873)

Utilizator verde.cristian2005Verde Flaviu-Cristian verde.cristian2005 Data 1 iunie 2016 13:12:36
Problema Consecutive Scor 100
Compilator cpp Status done
Runda Arhiva ICPC Marime 0.52 kb
#include <fstream>
using namespace std;
ifstream in("consecutive.in");
ofstream out("consecutive.out");
void bun(long long n)
{
 long long d=2,b,i=0,j;
 while(d*d<n)
 {
     if(n%d==0&&(n/d+1-d)%2==0)
         i++;
     d++;
 }
 out<<i<<'\n';
 d=2;
 while(d*d<n)
 {
     if(n%d==0&&(n/d+1-d)%2==0)
         out<<(n/d+1-d)/2<<" "<<(n/d+1-d)/2+d-1<<'\n';
     d++;
 }
}
int main()
{
    long long i,n,t;
    in>>t;
    for(i=1;i<=t;i++)
    {
     in>>n;
     n*=2;
     bun(n);
    }
    return 0;
}