Last active
October 12, 2015 11:54
-
-
Save ryoppippi/236998296b0fa86057ab to your computer and use it in GitHub Desktop.
昨日ハノイの塔が解けなくて本読んだら再帰という概念に出くわした。あまりにも強力でくらっとした。漸化式をそのままかけてしまう。美しい。そしてこれがそのコード。 #課題 #coding #c #CodePiece
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void func1(int n,int from, int to,int work,FILE *fq){ | |
if (n>0) { | |
func1(n-1,from,work,to,fq); | |
fprintf(fq,"%d %d %d\n",n, from, to ); | |
func1(n-1,work,to,from,fq); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment