Cod sursa(job #1260311)

Utilizator Danut99Dinu Danut Danut99 Data 11 noiembrie 2014 08:19:54
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int main(){
  int n;
  ifstream inf("cifra.in");
  inf>>n;

  ofstream of("cifra.out");

  int s=0;
  int r;
  for(int y=1; y<=n;y++){
     inf>>r;
  for(int i=1; i<=r; i++){
    s=s+(int)pow(i%10,i%10)%10;
    s=s%10;
   }
     of<<s<<endl;
     s=0;
  }


  inf.close();
  of.close();

    return 0;
}