Cod sursa(job #339907)
| Utilizator | Data | 12 august 2009 06:06:31 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<fstream>
using namespace std;
long int putere(long int cifra) {
long int numar = 1;
for(long int i = 0; i < cifra; i++) {
numar *= cifra;
}
return numar;
}
int main() {
ofstream fout("cifra.out");
ifstream fin("cifra.in");
long int cifra, d, t;
long int z = 0;
fin >> t;
for(d = 0; d < t; d++) {
fin >> cifra;
z += putere(cifra);
fout << z%10 << endl;
}
return 0;
}
