Cod sursa(job #184145)

Utilizator raica_cristiraica dumitru cristian raica_cristi Data 23 aprilie 2008 10:10:16
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include<fstream>
#include<stdio.h>
#include<math.h>

using namespace std;

ifstream fin ("cifra.in");

int main ()
{
    freopen("cifra.out","w",stdout);
    long long unsigned i,n,k,k1;
    long long unsigned s;
    s=0;
    fin>>n;
    for(i=1;i<=n;i++)
    {
                     fin>>k;
                     if(k>10)
                     k1=k%10;
                     else
                     k1=k;
                     s=s+pow(k,k);
                     s%=10;
                   //  printf("%d ",k);
                     printf("%d",s);
                     printf("\n");
                     }
                     return 0;
                     }