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