Cod sursa(job #1808762)
Utilizator | Data | 18 noiembrie 2016 01:50:29 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main(void)
{
unsigned short int s=0, t;
f>>t;
while(t!=0)
{
char q;
f>>q;
unsigned short int z = q - '0', x = 1;
q = q - '0';
while (z!=0)
{
x *= q;
--z;
}
s += x;
g<<s%10<<endl;
t--;
}
return 0;
}