Pagini recente » Cod sursa (job #1581170) | Cod sursa (job #1328580) | Cod sursa (job #2020162) | Cod sursa (job #1906396) | Cod sursa (job #2267804)
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int v[101] = { 0, 1, 5, 2, 8, 3, 9, 2, 8, 7, 7, 8, 4, 7, 3, 8, 4, 1, 5, 4, 4, 5, 9, 6, 2};
int t;
string n;
fin >> t;
int a;
for (int i = 1; i <= t; i++)
{
fin >> n;
int length = n.size();
if (length == 1)
{
a = n[0] - '0';
}
else if (length >= 2)
{
a = (n[length - 2] - '0') * 10 + (n[length - 1] - '0');
}
fout << v[a] << endl;
}
return 0;
}