Cod sursa(job #237923)

Utilizator jupanubv92Popescu Marius jupanubv92 Data 30 decembrie 2008 22:05:11
Problema Cifra Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.8 kb
#include<stdio.h>
#include<string.h>
#define d int
#define ld long int
#define lld long long
#define caractere char
#define afis printf
#define cit scanf

int YAHOO;

int main()
{
    freopen("cifra.in","r",stdin);
    freopen("cifra.out","w",stdout);
    d VALORII[101]={0,1,5,2,8,3,9,2,8,7,7,8,4,7,3,8,4,1,5,4,4};
    cit ("%d ",&YAHOO);
    for(int i=20;i<=100;i++)
      VALORII[i]=(VALORII[i-20]+4)%10;
    for ( int RO = 1 ; RO <= YAHOO ; RO ++)
      {
         caractere InTraRe [ 105 ] ;
         fgets ( InTraRe , 104 , stdin ) ;
         int Go = strlen ( InTraRe )-1;
         if( Go > 1)
           {
             printf("%d\n",VALORII[(InTraRe[Go-2]-'0')*10+InTraRe[Go-1]-'0']);
           }
          else afis("%d\n",VALORII[InTraRe[Go-1]-'0']);


      }
    return 0;
}