Cod sursa(job #1317005)
Utilizator | Data | 14 ianuarie 2015 14:10:43 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <iostream>
#include <fstream>
#include <math.h>
#include <string.h>
using namespace std;
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,i ;
f >> t ;
char numar[101];
char last,l1;
short c;
long long suma = 0 ;
f.get();
for (i=1;i<=t;i++)
{ f.get(numar,101);f.get();
c=numar[strlen(numar)-1]-48;
suma += (int)pow(c,c)%10;
suma = suma % 10 ;
}
g<<suma;
f.close();
g.close();
return 0;
}