Cod sursa(job #1100829)

Utilizator LunguIoanAdrianLungu Ioan Adrian LunguIoanAdrian Data 7 februarie 2014 15:49:46
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>
#include <cmath>
#include <iostream>
using namespace std;

int main()
{
    int t,x,uc,s=0;
    ifstream in("cifra.in");
    ofstream out("cifra.out");
    in >> t;
    while(in>>x)
    {
        while(x!=0)
        {
            s=s+pow(x,x);
            x--;
            //cout << s <<" ";
        }
      //  cout << endl;
        uc=s%10;
        out << uc<< "\n";
        s=0;
    }
    in.close();
    out.close();
    return 0;
}