Cod sursa(job #1596347)
| Utilizator | Data | 10 februarie 2016 22:12:48 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
ifstream input ("cifra.in");
long long int v[30000];
int i = 0;
while(!input.eof()){
input >> v[i];
i++;
}
i -= 2;
input.close();
ofstream output ("cifra.out");
int ct;
for(ct = 0;ct <= i;ct++){
long long int sum = 0;
for(int start = 1; start <= v[ct]; start++){
sum = sum + pow(start, start);
}
output << sum % 10 << endl;
}
output.close();
return 0;
}
