Cod sursa(job #1260308)
Utilizator | Data | 11 noiembrie 2014 08:17:28 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main(){
int n;
ifstream inf("cifra.in");
inf>>n;
ofstream of("cifra.out");
int s=0;
int r;
for(int y=1; y<=n;y++){
inf>>r;
for(int i=1; i<=r; i++){
s=s+pow(i%10,i%10);
s=s%10;
}
of<<s<<endl;
s=0;
}
inf.close();
of.close();
return 0;
}