Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- using namespace std;
- ifstream fin("14.in");
- ofstream fout("14.txt");
- void recurse(long long int n, long long int as, long long int bs, long long int sums, long long int pras, long long int ys)
- {
- if(ys!=n){
- sums=bs+as;
- pras=as;
- as=bs;
- bs=pras+bs;
- ys++;
- recurse(n, as, bs, sums, pras, ys);}
- else{
- ofstream fout("14.txt");
- fout<<sums<<endl;}
- }
- int main()
- {
- long long int s, a=0, b=1, sum=1, pra=1, y=1;
- fin>>s;
- if(s==0){fout<<"0"<<endl;}
- else{recurse(s,a,b,sum,pra,y);}
- return 0;
- }
Add Comment
Please, Sign In to add comment