Cod sursa(job #259526)

Utilizator Cristy94Buleandra Cristian Cristy94 Data 15 februarie 2009 14:28:36
Problema Koba Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.24 kb
#include<fstream.h>
ifstream f("koba.in");
ofstream g("koba.out");
int main(){
int x,y,z,i,p;
long n,s;
f>>n>>x>>y>>z;
s=x%10+y%10+z%10;
for(i=4;i<=n;i++){
    p=(z+y*x)%10;
    s=s+p;
    x=y;y=z;z=p;}
g<<s;
return 0;
}