Pagini recente » Cod sursa (job #2904337) | Cod sursa (job #813784) | Cod sursa (job #2792942) | Cod sursa (job #2511264) | Cod sursa (job #171413)
Cod sursa(job #171413)
// Nunta PreOni 2008
#include <fstream>
using namespace std;
ifstream fin("nunta.in");
ofstream fout("nunta.out");
int main(){
int A[2][10000],i,t=0,n,j;
fin>>n;
A[0][0]=A[0][1]=A[1][0]=A[1][1]=1;
for (j=1;j<=n-1;j++){
for (i=1;i<=A[0][0]||i<=A[1][0]||t;i++,t/=10)
A[j%2][i]=(t+=A[j%2][i]+A[(j+1)%2][i])%10;
A[j%2][0]=i-1;
}
for (i=A[n%2][0];i>=1;i--)
fout<<A[(n-1)%2][i];
fout.close();
return 0;
}