Cod sursa(job #2940317)

Utilizator mayamateescuMaya Mateescu mayamateescu Data 15 noiembrie 2022 11:45:12
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>
#include <iostream>
#include <cmath>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
unsigned int T, n, s=0, i, j;
char N;

int main()
{
    f>>T;
    for(i=1; i<=T; i++){
        f>>N;
        n=(int)N-48;
        cout<<n<<" ";
        for(j=1; j<=n; j++){
            s=s+pow(j, j);
        }
        g<<s%10<<"\n";
        s=0;
    }
    return 0;
}