Cod sursa(job #908499)
| Utilizator | Data | 9 martie 2013 15:42:15 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.7 kb |
#include <fstream>
using namespace std;
ifstream is ("cifra.in");
ofstream os ("cifra.out");
int main()
{
int t, nr , a[30000], s = 0, x;
is >> t;
for ( int i = 0; i < t; ++i)
is >> a[i];
for ( int i = 0; i < t; ++i)
{
s = 0;
x = 1;
while ( a[i] )
{
nr = 1;
for ( int j = x; j > 0; --j )
nr *= x;
s += nr;
a[i]--;
x++;
}
os << s % 10 << '\n';
}
os.close();
is.close();
return 0;
}
