Cod sursa(job #633031)

Utilizator Marin7ygsepoywepoj Marin7 Data 12 noiembrie 2011 19:43:25
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
#include <iostream>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");

int main()
{
	int i,n,x=0;
	f>>n;
	for (i=1;i<=n;i++)
	{
		if (i%10==1)
			x+=1;
		else
			if (i%10==2)
				x+=4;
			else
				if (i%10==3)
					x+=7;
				else
					if (i%10==4)
						x+=6;
					else
						if (i%10==5)
							x+=5;
						else
							if (i%10==6)
								x+=6;
							else
								if (i%10==7)
									x+=7;
								else
									if (i%10==8)
										i+=6;
									else
										i+=9;
		
		if (x>=10)
			x=x%10;
	}
	cout<<x;
}