Cod sursa(job #42952)

Utilizator Bluedrop_demonPandia Gheorghe Bluedrop_demon Data 29 martie 2007 17:41:43
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.82 kb
{
    Problema fractii
}

Program fractii;

Type vector = array[0..1000000] of Longint;

Var n, i, j, l, k, aux : Longint;
    c : vector;
    nr : int64;

Begin
    Assign( input, 'fractii.in' );
    Reset( input );
        Readln( n );
    Close( input );

    nr := n shl 1;
    nr := nr-1;

    For i := 2 to n do
        if c[i] = 0 then
            Begin
                aux := i;
                j := 0;
                While j <= n do
                    Begin
                        j := j+aux;
                        c[j] := aux;
                    End;
            End;

    For i := 2 to n-1 do
        For j := 2 to i-1 do
            If c[i] <> c[j] then nr := nr+2;

    Assign( output, 'fractii.out' );
    Rewrite( output );
        Writeln( nr );
    Close( output );
End.