Cod sursa(job #868095)
| Utilizator | Data | 30 ianuarie 2013 17:35:41 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("cifra.in");
ofstream g ("cifra.out");
int T,N,i,s,j;
int main()
{
f>>T;
for (i=1;i<=T;i++)
{
f>>N;
s=0;
for (j=1;j<=N;j++)
{if (j%10==1) s+=1;
if (j%10==2) s+=4;
if (j%10==3) s+=7;
if (j%10==4) s+=6;
if (j%10==5) s+=5;
if (j%10==6) s+=6;
if (j%10==7) s+=3;
if (j%10==8) s+=6;
if (j%10==9) s+=9;
if (j%10==0) s+=0;}
g<<s%10<<endl;
}
f.close();
g.close();
return 0;
}
