Cod sursa(job #125755)

Utilizator cos_min_max_ionCosmin Ion cos_min_max_ion Data 20 ianuarie 2008 17:35:46
Problema Cifra Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include<iostream.h>
#include<stdio.h>
int main()
{ long long  n;
  int i,t,v[20]={4,1,5,2,8,3,9,2,8,7,7,8,4,7,3,8,4,1,5,4};
  freopen("cifra.in","rt" ,stdin);
  freopen("cifra.out","wt" ,stdout);
  cin>>t;
  for(i=0;i<t;i++)
   { cin>>n;
     cout<<((n/20)*4%10+v[n%20])%10<<endl;
   }
  return 0;
}