Cod sursa(job #120829)

Utilizator lache92Hulub Ionut-Adrian lache92 Data 6 ianuarie 2008 19:10:04
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <fstream.h>
#include <math.h>

int main() {
      ifstream f("cifra.in");
      register int n, i = 1, y;
      unsigned long int t, aux, aux2=0;
      ofstream fout("cifra.out");
      f>>n;
      while (i <= n) {
         f>>t;
         for (y = 1; y <= i; y++) {
               aux = pow(y, y);
               aux2 += aux%10;
               if(aux2 > 9)
                       aux2 = aux2 % 10;
         }
         fout<<aux2<<'\n';
         i++;
         aux = 0;
         aux2 = 0;
      }
      f.close();
      fout.close();
      return 0;
}