Cod sursa(job #1187338)

Utilizator CourageAntal Alexandru Courage Data 18 mai 2014 10:22:25
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <fstream>
#include <math.h>

using std :: ifstream;
using std :: ofstream;

ifstream in ("intrare.txt");
ofstream out ("iesire.txt");

int last(int long long n)
{
    return n%10;
}

int main (void)
{
    int long long n, i, x, s=0;
    in >> n;
    for (i=0 ; i<n ; i++)
    {
        in >> x;
        s += last(pow(x,x));
        out << s%10 << '\n';
    }
    return 0;
}