Cod sursa(job #22331)

Utilizator LiviutPorumb Dany Liviut Data 26 februarie 2007 09:41:10
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<iostream.h>
#include<fstream.h>
int n,i,j,k,v[30001]; 
int main(){
    fstream f("cifra.in",ios::in);
    fstream g("cifra.out",ios::out);
    f>>n;
    while(f>>v[i])
    i++;
    for(i=0;i<n;i++)
    {
        j=1;
        for(k=2;k<=v[i];k++)
        {
            j=j+pow(k%10,k%10);
            j=j%10;
        }
        g<<j<<endl;  
    }
    f.close();
    g.close();        
}