Pagini recente » Clasamentul arhivei Infoarena Monthly | Istoria paginii runda/oji_bv_11-12_2025 | Cod sursa (job #2288260) | Cod sursa (job #864975) | Cod sursa (job #2554237)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int main()
{
int par[10]={0, 1, 5, 12, 18, 23, 29, 32, 38, 47};
int impar[10]={0, 1, 7, 10, 16, 21, 27, 34, 38, 47};
int T,n;
fin>>T;
for(int j=1;j<=T;j++)
{
fin>>n;
int c=n/10;
int r=n%10;
int s=c*7;
if(c%2==0)
{
s+=par[r];
}
else
{
s+=impar[r];
}
fout<<s%10<<endl;
}
return 0;
}