Cod sursa(job #1220361)

Utilizator valentinraduValentin Radu valentinradu Data 17 august 2014 03:18:21
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <math.h>
#include <fstream>

using namespace std;

ifstream f("cifra.in");
ofstream g("cifra.out");

int main()
{
    int t;
    f>>t;
    for (int i = 1; i  <=  t; i ++)
    { 
        int a;
        f>>a;
        int S = 0;
        for (int j = 1; j  <=  a; j ++)
        { 
            S = S + pow(j, j);
        }
        g<<fmod(S, 10);
    }
    return 0;
}