#include<stdio.h> int prc=0; void Deal(int a,int s,int e) { if(a==1) { printf("#%d : move the dish from #%d to #%d\n",++prc,s,e); return; } Deal(a-1,s,6-s-e); printf("#%d : move the dish from #%d to #%d\n",++prc,s,e); Deal(a-1,6-s-e,e); } int main() { int k;scanf("%d",&k); Deal(k,1,3); return 0; }
沒有留言:
張貼留言