Cod sursa(job #1462760)
Utilizator | Data | 18 iulie 2015 21:19:35 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 1.28 kb |
#include <fstream>
using namespace std;
ifstream in("cifra.in");
ofstream out("cifra.out");
int main(){
long i,n,s=0;
char f;
in>>n;
for(i=1;i<=n;i++)
{
in>>f;
if(i%10==0)
{
s=(s+0)%10;
out<<s;
out<<endl;
}
if(i%10==1)
{
s=(s+1)%10;
out<<s;
out<<endl;
}
if(i%10==2)
{
s=(s+4)%10;
out<<s;
out<<endl;
}
if(i%10==3)
{
s=(s+7)%10;
out<<s;
out<<endl;
}
if(i%10==4)
{
s=(s+6)%10;
out<<s;
out<<endl;
}
if(i%10==5)
{
s=(s+5)%10;
out<<s;
out<<endl;
}
if(i%10==6)
{
s=(s+6)%10;
out<<s;
out<<endl;
}
if(i%10==7)
{
s=(s+9)%10;
out<<s;
out<<endl;
}
if(i%10==8)
{
s=(s+2)%10;
out<<s;
out<<endl;
}
if(i%10==9)
{
s=(s+1)%10;
out<<s;
out<<endl;
}
}
return 0;
}