Pagini recente » Cod sursa (job #631298) | Cod sursa (job #1381206) | Cod sursa (job #885461) | Cod sursa (job #2158520) | Cod sursa (job #122692)
Cod sursa(job #122692)
#include<fstream.h>
unsigned long long int n;
int k,t,i,j;
int main(){
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>t;
for(i=1;i<=t;i++)
{f>>n;
k=n%20;j=k/20;j=(j*4)%10;
if(k==1) g<<(1+j)%10;
else
if(k==2) g<<(5+j)%10;
else
if(k==3) g<<(2+j)%10;
else
if(k==4) g<<(8+j)%10;
else
if(k==5) g<<(3+j)%10;
else
if(k==6) g<<(9+j)%10;
else
if(k==7) g<<(2+j)%10;
else
if(k==8) g<<(8+j)%10;
else
if(k==9) g<<(7+j)%10;
else
if(k==10) g<<(7+j)%10;
else
if(k==11) g<<(8+j)%10;
else
if(k==12) g<<(4+j)%10;
else
if(k==13) g<<(7+j)%10;
else
if(k==14) g<<(3+j)%10;
else
if(k==15) g<<(8+j)%10;
else
if(k==16) g<<(4+j)%10;
else
if(k==17) g<<(1+j)%10;
else
if(k==18) g<<(5+j)%10;
else
if(k==19) g<<(4+j)%10;
else
if(k==0) g<<(4+j)%10;
g<<'\n';
}
f.close();
g.close();
return 0;
}