Cod sursa(job #1419632)

Utilizator chiriacandrei25Chiriac Andrei chiriacandrei25 Data 16 aprilie 2015 00:16:12
Problema Pairs Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <cstdio>
#define ValMax 1000005

using namespace std;

bool fr[ValMax];
int cnt[ValMax],ciur[ValMax];

int main()
{
    int n,i,j,x;
    long long sol=0;
    freopen ("pairs.in","r",stdin);
    freopen ("pairs.out","w",stdout);
    scanf("%d", &n);
    for(i=1;i<=n;++i)
    {
        scanf("%d", &x); fr[x]=true;
        for(j=1;j*j<=x;++j)
            if(x%j==0)
            {
                ++cnt[j];
                if(j*j!=x) ++cnt[x/j];
            }
    }
    /*for(i=1;i<=1000000;++i)
        for(j=i;j<=1000000;j+=i)
            if(fr[j]) ++cnt[i];*/

    return 0;
}