Cod sursa(job #2779092)
Utilizator | Data | 2 octombrie 2021 17:55:05 | |
---|---|---|---|
Problema | Cifra | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int v[20]={1,5,2,8,3,9,2,8,7,7,8,4,7,3,8,4,1,5,4,4};
int main()
{
int a,x;
string s;
f>>a;
while(a--)
{ f>>s;
if(s.size()>=2)
{
x=stoi(s.substr(s.length() - 2).c_str());
g<<(v[(x-1)%20]+4*((x-1)/20))%10<<" ";
}
else
g<<v[(stoi(s.c_str()))%20-1]<<" ";
}
}