Cod sursa(job #1564683)
Utilizator | Data | 9 ianuarie 2016 21:10:45 | |
---|---|---|---|
Problema | Nunta | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <stdio.h>
using namespace std;
FILE*f=fopen("nunta.in","r");
int main()
{
unsigned a=0,b=1,x=0,y=0;
unsigned short n;
fscanf(f,"%d",&n);
fclose(f);
while (n>0)
{
n--;
b=a+b;
y=x+y;
a=b-a;
x=y-x;
y=b/1000000000+y;
b=b%1000000000;
}
FILE*f=fopen("nunta.out","w");
if (y>0) fprintf(f,"%u",y);
fprintf(f,"%u",b);
fclose(f);
return 0;
}