Cod sursa(job #2531960)

Utilizator dflrFlorea Deborah dflr Data 26 ianuarie 2020 22:13:40
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream f("cifra.in");
    ofstream g("cifra.out");
    int t,i,j,s,k,aux;
    f>>t; char x;
    for(i=0;i<t;i++){
        f>>x;
  //  for(i=0;i<t;i++)
            s=0;
            for(j=1;j<=x-'0';j++)
            {
                aux=j;
                for(k=1;k<=j-1;k++)
                    aux=(aux*j)%10;
                s+=aux;
            }
              //s+=long(pow(j,j))%10;
            g<<s%10<<"\n";
        }
    return 0;
}