Cod sursa(job #175658)

Utilizator firewizardLucian Dobre firewizard Data 10 aprilie 2008 11:39:44
Problema 12-Perm Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <stdio.h>
int n,aux,R2,R3,R4,i;
int main()
{
    freopen ("12perm.in","r",stdin);
    freopen ("12perm.out","w",stdout);
    scanf("%d",&n);
    R4=12;R3=6;R2=2;
    for (i=5;i<n+1;++i)
    {aux=R4;  
    R4 = (aux+R2+2*(i-2))& ((1<<20)-1) ;
    R2 = R3;
    R3=aux;}
    printf("%d",R4);
    return 0;
}