Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int counter=0;
- int tak(int x, int y, int z)
- {
- if (x<=y){
- return y;
- }
- else{
- counter++;
- return tak(tak(1-x,y,z), tak(y-1,z,x), tak(z-1,x,y));
- }
- }
- int main(){
- for (int n=0; n<20;n++){
- int w;
- w=tak(n,0,n+1);
- cout<<counter<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement