Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <fstream>
- #include <iomanip>
- using namespace std;
- unsigned x,y,z,n,m,i;
- void f(unsigned x, unsigned y, unsigned z, unsigned k)
- {
- int w;
- w=x+y-z;
- if(n!=k-1) f(y,z,w,k-1);
- cout<<w<<' ';
- }
- int main()
- {
- cin>>n>>x>>y>>z;
- fin:if(n<=3)
- {
- if(n==3)
- {
- cout<<z<<' '<<y<<' '<<x;
- return 0;
- }
- else if(n==2)
- {
- cout<<z<<' '<<y;
- return 0;
- }
- else
- {
- cout<<z;
- return 0;
- }
- }
- f(x,y,z,n-3);
- n=3;
- goto fin;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement