Cod sursa(job #2579829)
| Utilizator | Data | 12 martie 2020 20:54:50 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
//// https://infoarena.ro/problema/cifra
#include "iostream"
#include "fstream"
#include "math.h"
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int sum(int cif){
int rez = 1;
for(int i = 2;i <= cif;i++){
rez = rez + pow(i,i);
}
return rez;
}
int main(){
char c;
bool ok = false;
while(fin >> c){
if(ok == false){
ok = true;
}
else{
cout << sum(c - '0') % 10 << endl;
}
}
return 0;
}