Cod sursa(job #1045924)
Utilizator | Data | 2 decembrie 2013 12:49:25 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
int n,i,nr,p,j,s;
f>>n;
for(i=1;i<=n;i++){
f>>nr;
p=1;
for(j=1;j<=nr;j++){
p=(p*nr)%10;
s=(s+p)%10;
}
}
g<<s;
f.close();
g.close();
return 0;
}