Pagini recente » Cod sursa (job #2956317) | Cod sursa (job #3030588) | Cod sursa (job #707499) | Cod sursa (job #2546963) | Cod sursa (job #719632)
Cod sursa(job #719632)
// koba.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "fstream"
using namespace std;
int main()
{
ifstream f("koba.in");
ofstream g("koba.out");
int n,t1,t2,t3;
f>>n>>t1>>t2>>t3;
t1%=10;
t2%=10;
t3%=10;
int i,s=0;
s=t1+t2+t3;
if(n>=3)
{
for(i=0;i<n-3;i++)
{
int t4;
t4=(t3+t2*t1)%10;
t1=t2%10;
t2=t3%10;
t3=t4%10;
s+=t4;
}
g<<s;
}
if(n==2)
g<<t1+t2;
if(n==1)
g<<t1;
return 0;
}