Cod sursa(job #1711854)

Utilizator lucaperjuLuca Perju Verzotti lucaperju Data 1 iunie 2016 12:52:11
Problema Consecutive Scor 0
Compilator cpp Status done
Runda Arhiva ICPC Marime 0.56 kb
#include <fstream>

using namespace std;
ifstream in ("consecutive.in");
ofstream out ("consecutive.out");
int main()
{
    int n,nr,i,j,s,cnt,w;
    in>>n;
    for(i=1;i<=n;i++)
    {
        in>>nr;
        nr=nr*2;
        cnt=0;
        for(j=2;j*j<=nr;j++)
        {
            if(nr%j==0)
            {
                cnt++;
            }
        }
        out<<cnt<<"\n";
        for(j=2;j*j<=nr;j++)
        {
            if(nr%j==0)
            {
                out<<nr/2/j-(j-1)/2<<" "<<nr/2/j-(j-1)/2+j-1<<"\n";
            }
        }
    }
    return 0;
}