Cod sursa(job #207931)
| Utilizator | Data | 13 septembrie 2008 12:11:58 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<fstream.h>
#include<math.h>
int main()
{
ifstream fin("cifra.in");
ofstream fout("cifra.out");
long n,t;
fin>>t;
long i=0,j=0,s=0;
for (i=0;i<t;i++)
{
fin>>n;
for (j=1;j<=n;j++)
{
int a,b;
a=j%10;
if (j>10)
b=(j%100)%4;
else
b=j%4;
if ( b!=0)
s=s+pow(a;b);
if (b==0)
s=s+pow(a;4);
s=s%10;
}
}
fout<<s;
fin.close();
fout.close();
return 0;
}
