Pagini recente » Cod sursa (job #2164967) | Simulare clasa a 9-a (combinatorica) | Cod sursa (job #957074) | Cod sursa (job #1736084) | Cod sursa (job #2480084)
/*
`-/oo+/- ``
.oyhhhhhhyo.`od
+hhhhyyoooos. h/
+hhyso++oosy- /s
.yoooossyyo:``-y`
..----.` ``.-/+:.`
`````..-::/.
`..```.-::///`
`-.....--::::/:
`.......--::////:
`...`....---:::://:
`......``..--:::::///:`
`---.......--:::::////+/`
----------::::::/::///++:
----:---:::::///////////:`
.----::::::////////////:-`
`----::::::::::/::::::::-
`.-----:::::::::::::::-
...----:::::::::/:-`
`.---::/+osss+:`
``.:://///-.
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cmath>
using namespace std;
const int INF = 2e9;
int v[105] = {0, 1, 5, 2, 8, 3, 9, 2, 8, 7, 7, 8, 4, 7, 3, 8, 4, 1, 5, 4};
char s[105];
int main()
{
freopen("cifra.in", "r", stdin);
freopen("cifra.out", "w", stdout);
int t;
char ch;
for(int i = 20; i <= 101; i++){
v[i] = v[i % 20] % 10;
}
scanf("%d ", &t);
while(t--){
fgets(s, 102, stdin);
int n = strlen(s) - 1;
int nr;
if(n >= 2) nr = (s[n - 2] - '0') * 10 + (s[n - 1] - '0');
else nr = s[0] - '0';
printf("%d\n", v[nr]);
}
return 0;
}